Not exactly sure what it is you're looking for. But many built-in objects can have the str() function applied to them with little problem.
If it's a custom class or similar you may need to look into the Pickling module. I don't know if you plan to use the string for something other than storing it on your FS; however here's the documentation.
I'm using a 3D program called blender, for some reason gameobjects objects can only store number type variables, bool and strings. Pickling would not good in this case as it serialises the whole object, and the contents will be no longer be up to date. I've noticed if you use the print command on an object refernce you get the Class type and memory address of it, I was wondering if there was a way to store that in a string, and then turn it back into an object reference when needed.
The id() function and maybe more, didn't have much time to look for more... Maybe the int of the reference is enough, you can definitely turn that into a string and recover your int or whatever you want....
However, if you would like to retrieve the object with that reference later... I don't quite know how that would work, I read something of a module mxTools , and also found this thread in a forum which looks like the same problem you have: