def get_loader(module_or_name):
 if (module_or_name in sys.modules):
  module_or_name = sys.modules[module_or_name]
 if isinstance(module_or_name, ModuleType):
  module = module_or_name
  loader = getattr(module, '__loader__', None)
  if (loader is not None):
   return loader
  fullname = module.__name__
 else:
  fullname = module_or_name
 return find_loader(fullname)

def get_loader ( module_or_name ) : if ( module_or_name in sys . modules ) : module_or_name = sys . modules [ module_or_name ] if isinstance ( module_or_name , ModuleType ) : module = module_or_name loader = getattr ( module , '__loader__' , None ) if ( loader is not None ) : return loader fullname = module . __name__ else : fullname = module_or_name return find_loader ( fullname )
get a pep 302 "loader" object for module_or_name if the module or package is accessible via the normal import mechanism .