def __new__(cls, name, bases, attrs):
        document = attrs.get("document")
        if document:
            try:
                attrs['model'] = document
            except __HOLE__:
                attrs['model'] = property(
                    lambda self: self.document
                )
        return super(WrapDocument, cls).__new__(cls, name, bases, attrs)
dataset/ETHPy150Open MongoEngine/django-mongoengine/django_mongoengine/utils/wrappers.py/WrapDocument.__new__