def get_obj_module(qualname):
modname = qualname<EOL>classname = None<EOL>attrname = None<EOL>while modname not in sys.modules:<EOL><INDENT>attrname = classname<EOL>modname, classname = modname.rsplit('<STR_LIT:.>', <NUM_LIT:1>)<EOL><DEDENT>if classname:<EOL><INDENT>cls = getattr(sys.modules[modname], classname)<EOL>modname = cls.__module__<EOL>obj = getattr(cls, attrname) if attrname else cls<EOL><DEDENT>else:<EOL><INDENT>obj = None<EOL><DEDENT>return obj, sys.modules[modname]<EOL>
Get a module/class/attribute and its original module by qualname