docs: def build_helpers_module_registry_dependencies(registry_name='calmjs.module'):
      """
      Return a tuple of funtions that will provide the functions that
      return the relevant sets of module registry records based on the
      dependencies defined for the provided packages.
      """
  
      def get_module_registry_dependencies(
              pkg_names, registry_name=registry_name, working_set=None):
          """
          Get dependencies for the given package names from module
          registry identified by registry name.
  
          For the given packages 'pkg_names' and the registry identified
          by 'registry_name', resolve the exported location for just the
          package.
          """
  
          working_set = working_set or default_working_set
          registry = get(registry_name)
          if not isinstance(registry, BaseModuleRegistry):
              return {}
          result = {}
          for pkg_name in pkg_names:
              result.update(registry.get_records_for_package(pkg_name))
          return result
  
      def _flatten_module_registry_dependencies(
              pkg_names, registry_name, find_dists, working_set):
          """
          Flatten dependencies for the given package names from module
          registry identified by registry name using the find_dists
          function on the given working_set.
  
          For the given packages 'pkg_names' and the registry identified
          by 'registry_name', resolve and flatten all the exported
          locations.
          """
  
          result = {}
          registry = get(registry_name)
          if not isinstance(registry, BaseModuleRegistry):
              return result
  
          dists = find_dists(pkg_names, working_set=working_set)
          for dist in dists:
              result.update(registry.get_records_for_package(dist.project_name))
  
          return result
  
      def flatten_module_registry_dependencies(
              pkg_names, registry_name=registry_name, working_set=None):
          """
          Flatten dependencies for the specified packages from the module
          registry identified by registry name.
  
          For the given packages 'pkg_names' and the registry identified
          by 'registry_name', resolve and flatten all the exported
          locations.
          """
  
          working_set = working_set or default_working_set
          return _flatten_module_registry_dependencies(
              pkg_names, registry_name, find_packages_requirements_dists,
              working_set)
  
      def flatten_parents_module_registry_dependencies(
              pkg_names, registry_name=registry_name, working_set=None):
          """
          Flatten dependencies for the parents of the specified packages
          from the module registry identified by registry name.
  
          For the given packages 'pkg_names' and the registry identified
          by 'registry_name', resolve and flatten all the exported
          locations.
          """
  
          working_set = working_set or default_working_set
          return _flatten_module_registry_dependencies(
              pkg_names, registry_name, find_packages_parents_requirements_dists,
              working_set)
  
      return (
          get_module_registry_dependencies,
          flatten_module_registry_dependencies,
          flatten_parents_module_registry_dependencies,
      )