def get_class_from_string(path, default=None):
 try:
  from importlib import import_module
 except ImportError:
  from django.utils.importlib import import_module
 i = path.rfind('.')
 (module, attr) = (path[:i], path[(i + 1):])
 mod = import_module(module)
 try:
  return getattr(mod, attr)
 except AttributeError:
  if default:
   return default
  else:
   raise ImportError('Cannot import name {} (from {})'.format(attr, mod))

def get_class_from_string ( path , default = None ) : try : from importlib import import_module except ImportError : from django . utils . importlib import import_module i = path . rfind ( '.' ) ( module , attr ) = ( path [ : i ] , path [ ( i + 1 ) : ] ) mod = import_module ( module ) try : return getattr ( mod , attr ) except AttributeError : if default : return default else : raise ImportError ( 'Cannot import name {} (from {})' . format ( attr , mod ) )
return the class specified by the string .