code: def _load_spec(spec: ModuleSpec, module_name: str) -> ModuleType:
      name = getattr(spec, "__name__", module_name)
      if name in sys.modules:
          return sys.modules[name]
      module = importlib.util.module_from_spec(spec)
      sys.modules[
          name
      ] = module  # cache (it also ensures `==` works on loaded items)
      spec.loader.exec_module(module)  # type: ignore
      return module
  
imports: import ast
  import importlib
  import os
  import pathlib
  import sys
  from glob import iglob
  from configparser import ConfigParser
  from importlib.machinery import ModuleSpec
  from itertools import chain
  from typing import TYPE_CHECKING, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, TypeVar, Union, cast
  from pathlib import Path
  from types import ModuleType
  from distutils.errors import DistutilsOptionError
  from .._path import same_path
  from ..warnings import SetuptoolsWarning
label_desc: Use image node_id 8 for calling a global function with example usage: _load_spec(spec, module_name) and returns: module, sys