@classmethod
    def instantiate(cls, obj, datatype=None):
        if isinstance(obj, LDObject):
            return obj

        if hasattr(obj, 'datatype') and not datatype:
            datatype = getattr(obj, 'datatype')

        if not datatype:
            raise Exception("no datatype found")

        # nulls
        if obj == None:
            return None

        # the class
        dynamic_cls = get_class(datatype)

        # instantiate it and load data
        return_obj = dynamic_cls(obj)
        return_obj.loadData()

        return return_obj
Usage:
dataset/ETHPy150Open benadida/helios-server/helios/datatypes/__init__.py/LDObject.instantiate--crossover with--dataset/ETHPy150Open pinax/pinax-comments/pinax/comments/templatetags/pinax_comments_tags.py/comment_target