def import_(path):
if isinstance(path, str):<EOL><INDENT>v = path.split('<STR_LIT::>')<EOL>if len(v) == <NUM_LIT:1>:<EOL><INDENT>x = path.rsplit('<STR_LIT:.>', <NUM_LIT:1>)<EOL>if len(x) == <NUM_LIT:2>:<EOL><INDENT>module, func = x<EOL><DEDENT>else:<EOL><INDENT>module, func = x[<NUM_LIT:0>], '<STR_LIT>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>module, func = v<EOL><DEDENT>mod = __import__(module)<EOL>f = mod<EOL>if func:<EOL><INDENT>for x in func.split('<STR_LIT:.>'):<EOL><INDENT>f = getattr(f, x)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>f = path<EOL><DEDENT>return f<EOL>
Import string format module, e.g. 'uliweb.orm' or an object
return module object and object