def import_class(classpath, package=None):
if '<STR_LIT:.>' in classpath:<EOL><INDENT>module, classname = classpath.rsplit('<STR_LIT:.>', <NUM_LIT:1>)<EOL>if package and not module.startswith('<STR_LIT:.>'):<EOL><INDENT>module = '<STR_LIT>'.format(module)<EOL><DEDENT>mod = import_module(module, package)<EOL><DEDENT>else:<EOL><INDENT>classname = classpath<EOL>mod = import_module(package)<EOL><DEDENT>return getattr(mod, classname)<EOL>
Load and return a class