code: def post_order_documents(app, env, docnames):
      # Order the documents to be processed so that children come before parents,
      # since the TOC-sorting code relies on the metadata for child documents
      # having already been read. (Just changing the priority of that hook doesn't
      # work, since that doesn't change that hooks for a given document are
      # executed all together, whereas we need to enforce ordering across
      # documents.)
      docnames.sort(
          key=lambda name: len(re.sub("_index$", "", name)),
          reverse=True,
      )
  
imports: import re
  import sys
  from docutils import nodes
  from sphinx.addnodes import toctree
label_desc: Use image node_id 1 for calling a global function with example usage: post_order_documents(app, env, docnames) without return types