def load_handler(path, *args, **kwargs):
 i = path.rfind(u'.')
 (module, attr) = (path[:i], path[(i + 1):])
 try:
  mod = importlib.import_module(module)
 except ImportError as e:
  raise ImproperlyConfigured((u'Error importing upload handler module %s: "%s"' % (module, e)))
 except ValueError:
  raise ImproperlyConfigured(u'Error importing upload handler module.Is FILE_UPLOAD_HANDLERS a correctly defined list or tuple?')
 try:
  cls = getattr(mod, attr)
 except AttributeError:
  raise ImproperlyConfigured((u'Module "%s" does not define a "%s" upload handler backend' % (module, attr)))
 return cls(*args, **kwargs)

def load_handler ( path , * args , ** kwargs ) : i = path . rfind ( u'.' ) ( module , attr ) = ( path [ : i ] , path [ ( i + 1 ) : ] ) try : mod = importlib . import_module ( module ) except ImportError as e : raise ImproperlyConfigured ( ( u'Error importing upload handler module %s: "%s"' % ( module , e ) ) ) except ValueError : raise ImproperlyConfigured ( u'Error importing upload handler module.Is FILE_UPLOAD_HANDLERS a correctly defined list or tuple?' ) try : cls = getattr ( mod , attr ) except AttributeError : raise ImproperlyConfigured ( ( u'Module "%s" does not define a "%s" upload handler backend' % ( module , attr ) ) ) return cls ( * args , ** kwargs )
given a path to a handler .