code: def find_parent_package(
      packages: List[str],
      package_dir: Mapping[str, str],
      root_dir: _Path,
  ) -> Optional[str]:
      """Find the parent package that is not a namespace."""
      packages = sorted(packages, key=len)
      common_ancestors = []
      for i, name in enumerate(packages):
          if not all(
              n.startswith(f"{name}.") for n in packages[i + 1 :]
          ):
              # Since packages are sorted by length, this condition is able
              # to find a list of all common ancestors.
              # When there is divergence (e.g. multiple root packages)
              # the list will be empty
              break
          common_ancestors.append(name)
  
      for name in common_ancestors:
          pkg_path = find_package_path(name, package_dir, root_dir)
          init = os.path.join(pkg_path, "__init__.py")
          if os.path.isfile(init):
              return name
  
      return None
  
imports: import itertools
  import os
  from fnmatch import fnmatchcase
  from glob import glob
  from pathlib import Path
  from typing import TYPE_CHECKING, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Union
  import _distutils_hack.override
  from distutils import log
  from distutils.util import convert_path
label_desc: Use image node_id 5 for calling a global function with example usage: find_parent_package(packages, package_dir, root_dir) and returns: None, name