code: def _find_spec(
      module_name: str, module_path: Optional[_Path]
  ) -> ModuleSpec:
      spec = importlib.util.spec_from_file_location(
          module_name, module_path
      )
      spec = spec or importlib.util.find_spec(module_name)
  
      if spec is None:
          raise ModuleNotFoundError(module_name)
  
      return spec
  
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 7 for calling a global function with example usage: _find_spec(module_name, module_path) and returns: spec