code: def generate_index_rst(
      example_cases, tag_to_modules, support_level_to_modules
  ):
      """
      Generates the index.rst file
      """
  
      support_contents = ""
      for k, v in support_level_to_modules.items():
          support_level = k.name.lower().replace("_", " ").title()
          module_contents = "\n\n".join(v)
          support_contents += f"""
  {support_level}
  {'-' * (len(support_level))}
  
  {module_contents}
  """
  
      tag_names = "\n    ".join(t for t in tag_to_modules.keys())
  
      with open(os.path.join(PWD, "blurb.txt")) as file:
          blurb = file.read()
  
      # Generate contents of the .rst file
      doc_contents = f""".. _torch.export_db:
  
  ExportDB
  ========
  
  {blurb}
  
  .. toctree::
      :maxdepth: 1
      :caption: Tags
  
      {tag_names}
  
  {support_contents}
  """
  
      with open(os.path.join(EXPORTDB_SOURCE, "index.rst"), "w") as f:
          f.write(doc_contents)
  
file_path: pytorch/docs/source/scripts/exportdb/generate_example_rst.py
imports: import inspect
  import os
  import re
  from pathlib import Path
  import torch
  import torch._dynamo
  from torch._export.db.case import ExportCase, normalize_inputs
  from torch._export.db.examples import all_examples
  from torch.export import export
label_desc: Use image node_id 2 for calling a global function with example usage: generate_index_rst(example_cases, tag_to_modules, support_level_to_modules) without return types