I recently developed a class named DocumentWrapper around some ORM document object in Python to transparently add some features to it without changing its inter
Override __class__ in your wrapper class DocumentWrapper:
class DocumentWrapper(object):
@property
def __class__(self):
return User
>>> isinstance(DocumentWrapper(), User)
True
This way no modifications to the wrapped class User are needed.
Python Mock does the same (see mock.py:612 in mock-2.0.0, couldn't find sources online to link to, sorry).