code: def register_generic_import_hook(hook, name, hook_dict, overwrite):
      # Create a deferred import hook if hook is a string name rather than
      # a callable function.
  
      if isinstance(hook, string_types):
          hook = _create_import_hook_from_string(hook)
  
      # Automatically install the import hook finder if it has not already
      # been installed.
  
      global _import_hook_finder_init
      if not _import_hook_finder_init:
          _import_hook_finder_init = True
          sys.meta_path.insert(0, ImportHookFinder())
  
      # Determine if any prior registration of an import hook for
      # the target modules has occurred and act appropriately.
  
      hooks = hook_dict.get(name, None)
  
      if hooks is None:
          # No prior registration of import hooks for the target
          # module. We need to check whether the module has already been
          # imported. If it has we fire the hook immediately and add an
          # empty list to the registry to indicate that the module has
          # already been imported and hooks have fired. Otherwise add
          # the post import hook to the registry.
  
          module = sys.modules.get(name, None)
  
          if module is not None:
              hook_dict[name] = []
              hook(module)
  
          else:
              hook_dict[name] = [hook]
  
      elif hooks == []:
          # A prior registration of import hooks for the target
          # module was done and the hooks already fired. Fire the hook
          # immediately.
  
          module = sys.modules[name]
          hook(module)
  
      else:
          # A prior registration of import hooks for the target
          # module was done but the module has not yet been imported.
  
          def hooks_equal(existing_hook, hook):
              if hasattr(existing_hook, "__name__") and hasattr(
                  hook, "__name__"
              ):
                  return existing_hook.__name__ == hook.__name__
              else:
                  return False
  
          if overwrite:
              hook_dict[name] = [
                  existing_hook
                  for existing_hook in hook_dict[name]
                  if not hooks_equal(existing_hook, hook)
              ]
  
          hook_dict[name].append(hook)
  
imports: import importlib
  import sys
  import threading
label_desc: Use image node_id 3 for calling a global function with example usage: register_generic_import_hook(hook, name, hook_dict, overwrite) and returns: unknown, False