def importobj(modpath, attrname):
module = __import__(modpath, None, None, ['<STR_LIT>'])<EOL>if not attrname:<EOL><INDENT>return module<EOL><DEDENT>retval = module<EOL>names = attrname.split("<STR_LIT:.>")<EOL>for x in names:<EOL><INDENT>retval = getattr(retval, x)<EOL><DEDENT>return retval<EOL>
imports a module, then resolves the attrname on it