code: def main():
      p = argparse.ArgumentParser(usage=__doc__.rstrip())
      p.add_argument(
          "--html", action="store_true", help="Build HTML output"
      )
      p.add_argument(
          "--no-clean",
          action="store_true",
          help="Skip removing old output",
      )
      args = p.parse_args()
  
      os.chdir(os.path.abspath(os.path.dirname(__file__)))
  
      dst_path = os.path.join("docs", "items")
      dst_path_ipynb = os.path.join("docs", "static", "items")
  
      if os.path.isdir(dst_path) and not args.no_clean:
          shutil.rmtree(dst_path)
      if not os.path.isdir(dst_path):
          os.makedirs(dst_path)
      if os.path.isdir(dst_path_ipynb):
          shutil.rmtree(dst_path_ipynb)
  
      shutil.copytree(
          os.path.join("ipython", "attachments"),
          os.path.join(dst_path, "attachments"),
      )
  
      shutil.copytree(
          "ipython",
          dst_path_ipynb,
          ignore=lambda src, names: [
              x for x in names if not x.endswith(".ipynb")
          ],
      )
  
      shutil.copytree(
          os.path.join("ipython", "attachments"),
          os.path.join(dst_path_ipynb, "attachments"),
      )
  
      tags = parse_wiki_legacy_tags()
      titles, tags_new = generate_files(dst_path=dst_path)
  
      tags.update(tags_new)
      write_index(dst_path, titles, tags)
  
      if args.html:
          subprocess.check_call(
              ["sphinx-build", "-b", "html", ".", "_build/html"],
              cwd="docs",
          )
  
file_path: scipy-cookbook/build.py
imports: import re
  import os
  import argparse
  import datetime
  import subprocess
  import shutil
  import lxml.html
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types