code: def copy_legacy_redirects(app, docname):
      if app.builder.name == "html":
          for html_src_path, new in redirect_files:
              # add ../ to old nested paths
              new = f"{'../' * html_src_path.count('/')}{new}"
              page = redirect_template.format(new=new)
              target_path = app.outdir + "/" + html_src_path
              os.makedirs(os.path.dirname(target_path), exist_ok=True)
              with open(target_path, "w") as f:
                  f.write(page)
  
imports: from __future__ import annotations
  import os
  import sys
  import sphinx_autosummary_accessors
label_desc: Use image node_id 1 for calling a global function with example usage: copy_legacy_redirects(app, docname) without return types