def get_loader(module_or_name):
    """Get a PEP 302 "loader" object for module_or_name

    If the module or package is accessible via the normal import
    mechanism, a wrapper around the relevant part of that machinery
    is returned.  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__.

    This function uses iter_importers(), and is thus subject to the same
    limitations regarding platform-specific special import locations such
    as the Windows registry.
    """
    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__
    elif module_or_name == sys:
        # Jython sys is not a real module; fake it here for now since
        # making it a module requires a fair amount of decoupling from
        # PySystemState
        fullname = "sys"
    else:
        fullname = module_or_name
    return find_loader(fullname)
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/pkgutil.py/get_loader/original