code: def rst_toctree(elements):
      return (
          "\n\n".join(
              (
                  ".. toctree::",
                  "\n".join(I(1) + e for e in sorted(elements) if e),
              )
          )
          if elements
          else ""
      )
  
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 10 for calling a global function with example usage: rst_toctree(elements) and returns: unknown