def get_cls_by_name(name, aliases={}, imp=None, package=None, **kwargs):
 if (imp is None):
  imp = importlib.import_module
 if (not isinstance(name, basestring)):
  return name
 name = (aliases.get(name) or name)
 (module_name, _, cls_name) = name.rpartition('.')
 if ((not module_name) and package):
  module_name = package
 try:
  module = imp(module_name, package=package, **kwargs)
 except ValueError as exc:
  raise ValueError(("Couldn't import %r: %s" % (name, exc)))
 return getattr(module, cls_name)

def get_cls_by_name ( name , aliases = { } , imp = None , package = None , ** kwargs ) : if ( imp is None ) : imp = importlib . import_module if ( not isinstance ( name , basestring ) ) : return name name = ( aliases . get ( name ) or name ) ( module_name , _ , cls_name ) = name . rpartition ( '.' ) if ( ( not module_name ) and package ) : module_name = package try : module = imp ( module_name , package = package , ** kwargs ) except ValueError as exc : raise ValueError ( ( "Couldn't import %r: %s" % ( name , exc ) ) ) return getattr ( module , cls_name )
get class by name .