def _get_importer(path_name):
 cache = sys.path_importer_cache
 try:
  importer = cache[path_name]
 except KeyError:
  cache[path_name] = None
  for hook in sys.path_hooks:
   try:
    importer = hook(path_name)
    break
   except ImportError:
    pass
  else:
   try:
    importer = imp.NullImporter(path_name)
   except ImportError:
    return None
  cache[path_name] = importer
 return importer

def _get_importer ( path_name ) : cache = sys . path_importer_cache try : importer = cache [ path_name ] except KeyError : cache [ path_name ] = None for hook in sys . path_hooks : try : importer = hook ( path_name ) break except ImportError : pass else : try : importer = imp . NullImporter ( path_name ) except ImportError : return None cache [ path_name ] = importer return importer
python version of pyimport_getimporter c api function .