code: def setup(app):
      app.connect("env-before-read-docs", post_order_documents)
  
      # This needs to have a priority set so that it runs before
      # sphinx.environment.collectors.TocTreeCollector, which looks at the values
      # stored in the node and copies their order elsewhere for later usage.
      app.connect("doctree-read", sort_toctree_by_weight, priority=0)
  
imports: import re
  import sys
  from docutils import nodes
  from sphinx.addnodes import toctree
label_desc: Use image node_id 3 for calling a global function with example usage: setup(app) without return types