def get_importer(path_item):
try:<EOL><INDENT>importer = sys.path_importer_cache[path_item]<EOL><DEDENT>except KeyError:<EOL><INDENT>for hook in sys.path_hooks:<EOL><INDENT>try:<EOL><INDENT>importer = hook(path_item)<EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>importer = None<EOL><DEDENT><DEDENT>sys.path_importer_cache.setdefault(path_item,importer)<EOL>if importer is None:<EOL><INDENT>try:<EOL><INDENT>importer = ImpWrapper(path_item)<EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return importer<EOL>
Retrieve a PEP 302 "importer" for the given path item

    If there is no importer, this returns a wrapper around the builtin import
    machinery.  The returned importer is only cached if it was created by a
    path hook.