def symbol_by_name(name, aliases={}, imp=None, package=None, sep=u'.', default=None, **kwargs):
 if (imp is None):
  imp = importlib.import_module
 if (not isinstance(name, string_t)):
  return name
 name = (aliases.get(name) or name)
 sep = (u':' if (u':' in name) else sep)
 (module_name, _, cls_name) = name.rpartition(sep)
 if (not module_name):
  (cls_name, module_name) = (None, (package if package else cls_name))
 try:
  try:
   module = imp(module_name, package=package, **kwargs)
  except ValueError as exc:
   reraise(ValueError, ValueError(u"Couldn't import {0!r}: {1}".format(name, exc)), sys.exc_info()[2])
  return (getattr(module, cls_name) if cls_name else module)
 except (ImportError, AttributeError):
  if (default is None):
   raise
 return default

def symbol_by_name ( name , aliases = { } , imp = None , package = None , sep = u'.' , default = None , ** kwargs ) : if ( imp is None ) : imp = importlib . import_module if ( not isinstance ( name , string_t ) ) : return name name = ( aliases . get ( name ) or name ) sep = ( u':' if ( u':' in name ) else sep ) ( module_name , _ , cls_name ) = name . rpartition ( sep ) if ( not module_name ) : ( cls_name , module_name ) = ( None , ( package if package else cls_name ) ) try : try : module = imp ( module_name , package = package , ** kwargs ) except ValueError as exc : reraise ( ValueError , ValueError ( u"Couldn't import {0!r}: {1}" . format ( name , exc ) ) , sys . exc_info ( ) [ 2 ] ) return ( getattr ( module , cls_name ) if cls_name else module ) except ( ImportError , AttributeError ) : if ( default is None ) : raise return default
get symbol by qualified name .