code: def _find_package_path(import_name):
      """Find the path that contains the package or module."""
      root_mod_name, _, _ = import_name.partition(".")
  
      try:
          root_spec = importlib.util.find_spec(root_mod_name)
  
          if root_spec is None:
              raise ValueError("not found")
      except (ImportError, ValueError):
          # ImportError: the machinery told us it does not exist
          # ValueError:
          #    - the module name was invalid
          #    - the module name is __main__
          #    - we raised `ValueError` due to `root_spec` being `None`
          return os.getcwd()
  
      if root_spec.origin in {"namespace", None}:
          # namespace package
          package_spec = importlib.util.find_spec(import_name)
  
          if (
              package_spec is not None
              and package_spec.submodule_search_locations
          ):
              # Pick the path in the namespace that contains the submodule.
              package_path = pathlib.Path(
                  os.path.commonpath(
                      package_spec.submodule_search_locations
                  )
              )
              search_location = next(
                  location
                  for location in root_spec.submodule_search_locations
                  if _path_is_relative_to(package_path, location)
              )
          else:
              # Pick the first path.
              search_location = root_spec.submodule_search_locations[0]
  
          return os.path.dirname(search_location)
      elif root_spec.submodule_search_locations:
          # package with __init__.py
          return os.path.dirname(os.path.dirname(root_spec.origin))
      else:
          # module
          return os.path.dirname(root_spec.origin)
  
imports: from __future__ import annotations
  import importlib.util
  import os
  import pathlib
  import sys
  import typing
  from collections import defaultdict
  from functools import update_wrapper
  from jinja2 import FileSystemLoader
  from werkzeug.exceptions import default_exceptions
  from werkzeug.exceptions import HTTPException
  from werkzeug.utils import cached_property
  from ..None import typing
  from ..cli import AppGroup
  from ..helpers import get_root_path
  from ..templating import _default_template_ctx_processor
label_desc: Use image node_id 4 for calling a global function with example usage: _find_package_path(import_name) and returns: os, os, os, os