code: def parse_args(args: List[str]) -> Tuple[List[str], List[str]]:
      if "--" in args:
          split = args.index("--")
          override_args = args[:split]
          args = args[split + 1 :]
      else:
          override_args = []
  
      parser = argparse.ArgumentParser(
          usage="%(prog)s [[TORCH_OVERRIDES...] --] (--trial TRIAL)|(SCRIPT...)",
          description=(
              "Launch a script under pytorch distributed on a Determined cluster"
          ),
          epilog=(
              "TORCH_OVERRIDES may be a list of arguments to pass directly to "
              "torch.distributed.launch to override the values set by Determined automatically.  "
              "When provided, the list of override arguments must be terminated by a `--` argument."
          ),
      )
      # For legacy Trial classes.
      parser.add_argument(
          "--trial",
          help=(
              "use a Trial class as the entrypoint to training.  When --trial is used, the SCRIPT "
              "positional argument must be omitted."
          ),
      )
      # For training scripts.
      parser.add_argument(
          "script",
          metavar="SCRIPT...",
          nargs=argparse.REMAINDER,
          help="script to launch for training",
      )
      parsed = parser.parse_args(args)
  
      script = parsed.script or []
  
      if parsed.trial is not None:
          if script:
              # When --trial is set, any other args are an error.
              parser.print_usage()
              print(
                  "error: extra arguments to --trial:",
                  script,
                  file=sys.stderr,
              )
              sys.exit(1)
          script = det.util.legacy_trial_entrypoint_to_script(
              parsed.trial
          )
      elif not script:
          # There needs to be at least one script argument.
          parser.print_usage()
          print("error: empty script is not allowed", file=sys.stderr)
          sys.exit(1)
  
      return override_args, script
  
file_path: determined/harness/determined/launch/torch_distributed.py
imports: import argparse
  import logging
  import os
  import subprocess
  import sys
  from typing import List, Tuple
  import determined
label_desc: Use image node_id 6 for calling a global function with example usage: parse_args(args) and returns: override_args,  script