code: def setup(app):
      # NOTE: 'MOCK' is a custom option we introduced to illustrate mock outputs. Since
      # `doctest` doesn't support this flag by default, `sphinx.ext.doctest` raises
      # warnings when we build the documentation.
      import doctest
  
      doctest.register_optionflag("MOCK")
      app.connect("html-page-context", update_context)
  
      app.add_config_value("navbar_content_path", "navbar.yml", "env")
      app.connect("config-inited", parse_navbar_config)
      app.connect("html-page-context", setup_context)
      app.connect("html-page-context", add_custom_assets)
  
      # https://github.com/ines/termynal
      app.add_js_file("js/termynal.js", defer="defer")
      app.add_css_file("css/termynal.css")
  
      app.add_js_file("js/custom.js", defer="defer")
      app.add_css_file("css/custom.css", priority=800)
  
      app.add_js_file("js/csat.js")
      app.add_css_file("css/csat.css")
  
      app.add_js_file("js/assistant.js", defer="defer")
      app.add_css_file("css/assistant.css")
  
      base_path = pathlib.Path(__file__).parent
      github_docs = DownloadAndPreprocessEcosystemDocs(base_path)
      # Download docs from ecosystem library repos
      app.connect("builder-inited", github_docs.write_new_docs)
      # Restore original file content after build
      app.connect("build-finished", github_docs.write_original_docs)
  
      # Hook into the logger used by linkcheck to display a summary at the end.
      linkcheck_summarizer = LinkcheckSummarizer()
      app.connect(
          "builder-inited",
          linkcheck_summarizer.add_handler_to_linkcheck,
      )
      app.connect("build-finished", linkcheck_summarizer.summarize)
  
imports: from typing import Dict, Any
  from datetime import datetime
  from importlib import import_module
  import os
  import sys
  from jinja2.filters import FILTERS
  import sphinx
  from sphinx.ext import autodoc
  from docutils import nodes
  import pathlib
  import logging
  from custom_directives import DownloadAndPreprocessEcosystemDocs, update_context, LinkcheckSummarizer, parse_navbar_config, setup_context
  import packaging.version
  from setup import find_version
label_desc: Use image node_id 4 for calling a global function with example usage: setup(app) without return types