code: def get_parser() -> argparse.ArgumentParser:
      parser = argparse.ArgumentParser(
          usage="%(prog)s [OPTIONS] SOURCEDIR OUTPUTDIR [FILENAMES...]",
          epilog=__(
              "For more information, visit <https://www.sphinx-doc.org/>."
          ),
          description=__(
              """
  Generate documentation from source files.
  
  sphinx-build generates documentation from the files in SOURCEDIR and places it
  in OUTPUTDIR. It looks for 'conf.py' in SOURCEDIR for the configuration
  settings. The 'sphinx-quickstart' tool may be used to generate template files,
  including 'conf.py'
  
  sphinx-build can create documentation in different formats. A format is
  selected by specifying the builder name on the command line; it defaults to
  HTML. Builders can also perform other tasks related to documentation
  processing.
  
  By default, everything that is outdated is built. Output only for selected
  files can be built by specifying individual filenames.
  """
          ),
      )
  
      parser.add_argument(
          "--version",
          action="version",
          dest="show_version",
          version=f"%(prog)s {__display_version__}",
      )
  
      parser.add_argument(
          "sourcedir",
          metavar="SOURCE_DIR",
          help=__("path to documentation source files"),
      )
      parser.add_argument(
          "outputdir",
          metavar="OUTPUT_DIR",
          help=__("path to output directory"),
      )
      parser.add_argument(
          "filenames",
          nargs="*",
          help=__(
              "(optional) a list of specific files to rebuild. "
              "Ignored if --write-all is specified"
          ),
      )
  
      group = parser.add_argument_group(__("general options"))
      group.add_argument(
          "--builder",
          "-b",
          metavar="BUILDER",
          dest="builder",
          default="html",
          help=__("builder to use (default: 'html')"),
      )
      group.add_argument(
          "--jobs",
          "-j",
          metavar="N",
          default=1,
          type=jobs_argument,
          dest="jobs",
          help=__(
              "run in parallel with N processes, when possible. "
              "'auto' uses the number of CPU cores"
          ),
      )
      group.add_argument(
          "--write-all",
          "-a",
          action="store_true",
          dest="force_all",
          help=__(
              "write all files (default: only write new and "
              "changed files)"
          ),
      )
      group.add_argument(
          "--fresh-env",
          "-E",
          action="store_true",
          dest="freshenv",
          help=__(
              "don't use a saved environment, always read " "all files"
          ),
      )
  
      group = parser.add_argument_group(__("path options"))
      group.add_argument(
          "--doctree-dir",
          "-d",
          metavar="PATH",
          dest="doctreedir",
          help=__(
              "directory for doctree and environment files "
              "(default: OUTPUT_DIR/.doctrees)"
          ),
      )
      group.add_argument(
          "--conf-dir",
          "-c",
          metavar="PATH",
          dest="confdir",
          help=__(
              "directory for the configuration file (conf.py) "
              "(default: SOURCE_DIR)"
          ),
      )
  
      group = parser.add_argument_group("build configuration options")
      group.add_argument(
          "--isolated",
          "-C",
          action="store_true",
          dest="noconfig",
          help=__(
              "use no configuration file, only use settings from -D options"
          ),
      )
      group.add_argument(
          "--define",
          "-D",
          metavar="setting=value",
          action="append",
          dest="define",
          default=[],
          help=__("override a setting in configuration file"),
      )
      group.add_argument(
          "--html-define",
          "-A",
          metavar="name=value",
          action="append",
          dest="htmldefine",
          default=[],
          help=__("pass a value into HTML templates"),
      )
      group.add_argument(
          "--tag",
          "-t",
          metavar="TAG",
          action="append",
          dest="tags",
          default=[],
          help=__('define tag: include "only" blocks with TAG'),
      )
      group.add_argument(
          "--nitpicky",
          "-n",
          action="store_true",
          dest="nitpicky",
          help=__("nit-picky mode: warn about all missing references"),
      )
  
      group = parser.add_argument_group(__("console output options"))
      group.add_argument(
          "--verbose",
          "-v",
          action="count",
          dest="verbosity",
          default=0,
          help=__("increase verbosity (can be repeated)"),
      )
      group.add_argument(
          "--quiet",
          "-q",
          action="store_true",
          dest="quiet",
          help=__("no output on stdout, just warnings on stderr"),
      )
      group.add_argument(
          "--silent",
          "-Q",
          action="store_true",
          dest="really_quiet",
          help=__("no output at all, not even warnings"),
      )
      group.add_argument(
          "--color",
          action="store_const",
          dest="color",
          const="yes",
          default="auto",
          help=__("do emit colored output (default: auto-detect)"),
      )
      group.add_argument(
          "--no-color",
          "-N",
          action="store_const",
          dest="color",
          const="no",
          help=__("do not emit colored output (default: auto-detect)"),
      )
  
      group = parser.add_argument_group(__("warning control options"))
      group.add_argument(
          "--warning-file",
          "-w",
          metavar="FILE",
          dest="warnfile",
          help=__("write warnings (and errors) to given file"),
      )
      group.add_argument(
          "--fail-on-warning",
          "-W",
          action="store_true",
          dest="warningiserror",
          help=__("turn warnings into errors"),
      )
      group.add_argument(
          "--keep-going",
          action="store_true",
          dest="keep_going",
          help=__(
              "with --fail-on-warning, keep going when getting warnings"
          ),
      )
      group.add_argument(
          "--show-traceback",
          "-T",
          action="store_true",
          dest="traceback",
          help=__("show full traceback on exception"),
      )
      group.add_argument(
          "--pdb",
          "-P",
          action="store_true",
          dest="pdb",
          help=__("run Pdb on exception"),
      )
  
      return parser
  
imports: from __future__ import annotations
  import argparse
  import bdb
  import contextlib
  import locale
  import multiprocessing
  import os
  import pdb
  import sys
  import traceback
  from os import path
  from typing import TYPE_CHECKING, Any, TextIO
  from docutils.utils import SystemMessage
  import sphinx.locale
  from sphinx import __display_version__
  from sphinx.application import Sphinx
  from sphinx.errors import SphinxError, SphinxParallelError
  from sphinx.locale import __
  from sphinx.util._io import TeeStripANSI
  from sphinx.util.console import color_terminal, nocolor, red, terminal_safe
  from sphinx.util.docutils import docutils_namespace, patch_docutils
  from sphinx.util.exceptions import format_exception_cut_frames, save_traceback
  from sphinx.util.osutil import ensuredir
label_desc: Use image node_id 3 for calling a global function with example usage: get_parser() and returns: parser