docs: def build_helpers_egginfo_json(
          json_field, json_key_registry, json_filename=None):
      """
      Return a tuple of functions that will provide the usage of the
      JSON egginfo based around the provided field.
      """
  
      json_filename = (
          json_field + '.json' if json_filename is None else json_filename)
  
      # Default calmjs core implementation specific functions, to be used by
      # integrators intended to use this as a distribution.
  
      def get_extras_json(pkg_names, working_set=None):
          """
          Only extract the extras_json information for the given packages
          'pkg_names'.
          """
  
          working_set = working_set or default_working_set
          dep_keys = set(get(json_key_registry).iter_records())
          dists = pkg_names_to_dists(pkg_names, working_set=working_set)
          return flatten_dist_egginfo_json(
              dists, filename=json_filename,
              dep_keys=dep_keys, working_set=working_set
          )
  
      def _flatten_extras_json(pkg_names, find_dists, working_set):
          # registry key must be explicit here as it was designed for this.
          dep_keys = set(get(json_key_registry).iter_records())
          dists = find_dists(pkg_names, working_set=working_set)
          return flatten_dist_egginfo_json(
              dists, filename=json_filename,
              dep_keys=dep_keys, working_set=working_set
          )
  
      def flatten_extras_json(pkg_names, working_set=None):
          """
          Traverses through the dependency graph of packages 'pkg_names'
          and flattens all the egg_info json information
          """
  
          working_set = working_set or default_working_set
          return _flatten_extras_json(
              pkg_names, find_packages_requirements_dists, working_set)
  
      def flatten_parents_extras_json(pkg_names, working_set=None):
          """
          Traverses through the dependency graph of packages 'pkg_names'
          and flattens all the egg_info json information for parents of
          the specified packages.
          """
  
          working_set = working_set or default_working_set
          return _flatten_extras_json(
              pkg_names, find_packages_parents_requirements_dists, working_set)
  
      write_extras_json = partial(write_json_file, json_field)
  
      return (
          get_extras_json,
          flatten_extras_json,
          flatten_parents_extras_json,
          write_extras_json,
      )