code: def main():
      global DEBUG_ADAPT_STEP
  
      parser = argparse.ArgumentParser()
      parser.add_argument(
          "-d",
          "--debug",
          type=int,
          help="breakpoint at this adaptation step",
      )
      parser.add_argument(
          "-m",
          "--module",
          type=str,
          help="import module name instead of running a script",
      )
      parser.add_argument(
          "args",
          metavar="N",
          type=str,
          nargs="*",
          help="additional arguments",
      )
  
      argparse_args = []
      sys_argv = list(sys.argv)
  
      progname = sys_argv.pop(0)
  
      # this is a little crazy, works at the moment for:
      # module w args:
      #    python tools/trace_orm_adapter.py -m  pytest test/orm/test_query.py -s
      # script:
      #   python tools/trace_orm_adapter.py test3.py
      has_module = False
      while sys_argv:
          arg = sys_argv.pop(0)
          if arg in ("-m", "--module", "-d", "--debug"):
              argparse_args.append(arg)
              argparse_args.append(sys_argv.pop(0))
              has_module = arg in ("-m", "--module")
          else:
              if not has_module:
                  argparse_args.append(arg)
              else:
                  sys_argv.insert(0, arg)
              break
  
      options = parser.parse_args(argparse_args)
      sys.argv = ["program.py"] + sys_argv
  
      if options.module == "pytest":
          sys.argv.extend(["--capture", "sys"])
  
      import runpy
  
      if options.debug:
          DEBUG_ADAPT_STEP = options.debug
  
      if options.module:
          runpy.run_module(options.module, run_name="__main__")
      else:
          progname = options.args[0]
  
          runpy.run_path(progname)
  
file_path: sqlalchemy/tools/trace_orm_adapter.py
imports: from __future__ import annotations
  import argparse
  import contextlib
  import contextvars
  import sys
  from typing import TYPE_CHECKING
  from sqlalchemy.orm import util
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types