code: def build_postprocess(app, exception):
      """Sphinx "build-finished" event handler."""
      from sphinx.builders import html as builders
  
      if exception or not isinstance(
          app.builder, builders.StandaloneHTMLBuilder
      ):
          return
  
      global_substitutions = app.config.global_substitutions
  
      # Replace `|version|` in the docker-compose.yaml that requires manual substitutions
      for path in app.config.html_extra_with_substitutions:
          with open(path) as file:
              with open(
                  os.path.join(app.outdir, os.path.basename(path)), "w"
              ) as output_file:
                  for line in file:
                      output_file.write(
                          _manual_substitution(
                              line, global_substitutions
                          )
                      )
  
      # Replace `|version|` in the installation files that requires manual substitutions (in links)
      for path in app.config.manual_substitutions_in_generated_html:
          with open(
              os.path.join(
                  app.outdir,
                  os.path.dirname(path),
                  os.path.basename(path),
              )
          ) as input_file:
              content = input_file.readlines()
          with open(
              os.path.join(
                  app.outdir,
                  os.path.dirname(path),
                  os.path.basename(path),
              ),
              "w",
          ) as output_file:
              for line in content:
                  output_file.write(
                      _manual_substitution(line, global_substitutions)
                  )
  
imports: from __future__ import annotations
  import os
label_desc: Use image node_id 2 for calling a global function with example usage: build_postprocess(app, exception) without return types