code: def toctree_files(config_paths):
      # The first element is subpackages, the second is configs.
      packages = collections.defaultdict(lambda: (set(), set()))
      for path in config_paths:
          if path.endswith(".Config"):
              package, name, _ = path.rsplit(".", 2)
              name = f"{name}.Config"
          else:
              package, name = path.rsplit(".", 1)
          packages[package][1].add(path)
          while "." in package:
              base_package, subpackage = package.rsplit(".", 1)
              packages[base_package][0].add(package)
              package = base_package
  
      for package, (subpackages, configs) in packages.items():
          yield (
              package,
              rst_toctree(subpackages),
              rst_toctree(configs),
          )
  
imports: import collections
  import contextlib
  import itertools
  import json
  import os
  import typing
  from pytext.config import ConfigBase, ExportConfig, PyTextConfig
  from pytext.config.component import Registry
  from pytext.config.serialize import config_to_json
  from pytext.utils.file_io import PathManager
  from sphinx.ext.napoleon import GoogleDocstring
  from sphinx.pycode import ModuleAnalyzer
label_desc: Use image node_id 13 for calling a global function with example usage: toctree_files(config_paths) without return types