code: def find_spec(name, package=None):
      """Return the spec for the specified module.
  
      First, sys.modules is checked to see if the module was already imported. If
      so, then sys.modules[name].__spec__ is returned. If that happens to be
      set to None, then ValueError is raised. If the module is not in
      sys.modules, then sys.meta_path is searched for a suitable spec with the
      value of 'path' given to the finders. None is returned if no spec could
      be found.
  
      If the name is for submodule (contains a dot), the parent module is
      automatically imported.
  
      The name and package arguments work the same as importlib.import_module().
      In other words, relative module names (with leading dots) work.
  
      """
      fullname = (
          resolve_name(name, package) if name.startswith(".") else name
      )
      if fullname not in sys.modules:
          parent_name = fullname.rpartition(".")[0]
          if parent_name:
              parent = __import__(parent_name, fromlist=["__path__"])
              try:
                  parent_path = parent.__path__
              except AttributeError as e:
                  raise ModuleNotFoundError(
                      f"__path__ attribute not found on {parent_name!r} "
                      f"while trying to find {fullname!r}",
                      name=fullname,
                  ) from e
          else:
              parent_path = None
          return _find_spec(fullname, parent_path)
      else:
          module = sys.modules[fullname]
          if module is None:
              return None
          try:
              spec = module.__spec__
          except AttributeError:
              raise ValueError(
                  "{}.__spec__ is not set".format(name)
              ) from None
          else:
              if spec is None:
                  raise ValueError("{}.__spec__ is None".format(name))
              return spec
  
imports: from ._abc import Loader
  from ._bootstrap import module_from_spec
  from ._bootstrap import _resolve_name
  from ._bootstrap import spec_from_loader
  from ._bootstrap import _find_spec
  from ._bootstrap_external import MAGIC_NUMBER
  from ._bootstrap_external import _RAW_MAGIC_NUMBER
  from ._bootstrap_external import cache_from_source
  from ._bootstrap_external import decode_source
  from ._bootstrap_external import source_from_cache
  from ._bootstrap_external import spec_from_file_location
  from contextlib import contextmanager
  import _imp
  import functools
  import sys
  import types
  import warnings
label_desc: Use image node_id 4 for calling a global function with example usage: find_spec(name, package) and returns: _find_spec, None, spec