code: def main() -> None:
      from argparse import ArgumentParser, RawDescriptionHelpFormatter
  
      VERSION = None
      if "--version" in sys.argv:
          # We cannot import sympy before this is run, because flags like -C and
          # -t set environment variables that must be set before SymPy is
          # imported. The only thing we need to import it for is to get the
          # version, which only matters with the --version flag.
          import sympy
  
          VERSION = sympy.__version__
  
      usage = "isympy [options] -- [ipython options]"
      parser = ArgumentParser(
          usage=usage,
          description=__doc__,
          formatter_class=RawDescriptionHelpFormatter,
      )
  
      parser.add_argument(
          "--version", action="version", version=VERSION
      )
  
      parser.add_argument(
          "-c",
          "--console",
          dest="console",
          action="store",
          default=None,
          choices=["ipython", "python"],
          metavar="CONSOLE",
          help="select type of interactive session: ipython | python; defaults "
          "to ipython if IPython is installed, otherwise python",
      )
  
      parser.add_argument(
          "-p",
          "--pretty",
          dest="pretty",
          action="store",
          default=None,
          metavar="PRETTY",
          choices=["unicode", "ascii", "no"],
          help="setup pretty printing: unicode | ascii | no; defaults to "
          "unicode printing if the terminal supports it, otherwise ascii",
      )
  
      parser.add_argument(
          "-t",
          "--types",
          dest="types",
          action="store",
          default=None,
          metavar="TYPES",
          choices=["gmpy", "gmpy1", "python"],
          help="setup ground types: gmpy | gmpy1 | python; defaults to gmpy if gmpy2 "
          "or gmpy is installed, otherwise python",
      )
  
      parser.add_argument(
          "-o",
          "--order",
          dest="order",
          action="store",
          default=None,
          metavar="ORDER",
          choices=[
              "lex",
              "grlex",
              "grevlex",
              "rev-lex",
              "rev-grlex",
              "rev-grevlex",
              "old",
              "none",
          ],
          help="setup ordering of terms: [rev-]lex | [rev-]grlex | [rev-]grevlex | old | none; defaults to lex",
      )
  
      parser.add_argument(
          "-q",
          "--quiet",
          dest="quiet",
          action="store_true",
          default=False,
          help="print only version information at startup",
      )
  
      parser.add_argument(
          "-d",
          "--doctest",
          dest="doctest",
          action="store_true",
          default=False,
          help="use the doctest format for output (you can just copy and paste it)",
      )
  
      parser.add_argument(
          "-C",
          "--no-cache",
          dest="cache",
          action="store_false",
          default=True,
          help="disable caching mechanism",
      )
  
      parser.add_argument(
          "-a",
          "--auto-symbols",
          dest="auto_symbols",
          action="store_true",
          default=False,
          help="automatically construct missing symbols",
      )
  
      parser.add_argument(
          "-i",
          "--int-to-Integer",
          dest="auto_int_to_Integer",
          action="store_true",
          default=False,
          help="automatically wrap int literals with Integer",
      )
  
      parser.add_argument(
          "-I",
          "--interactive",
          dest="interactive",
          action="store_true",
          default=False,
          help="equivalent to -a -i",
      )
  
      parser.add_argument(
          "-D",
          "--debug",
          dest="debug",
          action="store_true",
          default=False,
          help="enable debugging output",
      )
  
      (options, ipy_args) = parser.parse_known_args()
      if "--" in ipy_args:
          ipy_args.remove("--")
  
      if not options.cache:
          os.environ["SYMPY_USE_CACHE"] = "no"
  
      if options.types:
          os.environ["SYMPY_GROUND_TYPES"] = options.types
  
      if options.debug:
          os.environ["SYMPY_DEBUG"] = str(options.debug)
  
      if options.doctest:
          options.pretty = "no"
          options.console = "python"
  
      session = options.console
  
      if session is not None:
          ipython = session == "ipython"
      else:
          try:
              import IPython
  
              ipython = True
          except ImportError:
              if not options.quiet:
                  from sympy.interactive.session import no_ipython
  
                  print(no_ipython)
              ipython = False
  
      args = {
          "pretty_print": True,
          "use_unicode": None,
          "use_latex": None,
          "order": None,
          "argv": ipy_args,
      }
  
      if options.pretty == "unicode":
          args["use_unicode"] = True
      elif options.pretty == "ascii":
          args["use_unicode"] = False
      elif options.pretty == "no":
          args["pretty_print"] = False
  
      if options.order is not None:
          args["order"] = options.order
  
      args["quiet"] = options.quiet
      args["auto_symbols"] = options.auto_symbols or options.interactive
      args["auto_int_to_Integer"] = (
          options.auto_int_to_Integer or options.interactive
      )
  
      from sympy.interactive import init_session
  
      init_session(ipython, **args)
  
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types