(module_or_name)
return find_loader(fullname)
Get a "loader" object for module_or_name

    Returns None if the module cannot be found or imported.
    If the named module is not already imported, its containing package
    (if any) is imported, in order to establish the package __path__.
Get a "loader" object for module_or_name
Get a loader object for module_or_name
def get_loader(module_or_name):
    """Get a "loader" object for module_or_name

    Returns None if the module cannot be found or imported.
    If the named module is not already imported, its containing package
    (if any) is imported, in order to establish the package __path__.
    """
    if module_or_name in sys.modules:
        module_or_name = sys.modules[module_or_name]
        if module_or_name is None:
            return None
    if isinstance(module_or_name, ModuleType):
        module = module_or_name
        loader = getattr(module, '__loader__', None)
        if loader is not None:
            return loader
        if getattr(module, '__spec__', None) is None:
            return None
        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 module_or_name is None : return None if isinstance ( module_or_name , ModuleType ) : module = module_or_name loader = getattr ( module , '__loader__' , None ) if loader is not None : return loader if getattr ( module , '__spec__' , None ) is None : return None fullname = module . __name__ else : fullname = module_or_name return find_loader ( fullname )