code: def parse_args() -> argparse.Namespace:
      """Parses the commandline args."""
      parser = argparse.ArgumentParser(
          description="Extracts ResultStore links from a build log.\n"
          "These can be then printed out, and/or output into a "
          "JUnit-based XML file inside a specified directory."
      )
  
      parser.add_argument("build_log", help="Path to a build log.")
      parser.add_argument(
          "--xml-out-path",
          required=False,
          help="Path to which to output "
          "the JUnit-based XML with ResultStore links.",
      )
      parser.add_argument(
          "--print",
          action="store_true",
          dest="print",
          default=False,
          help="Whether to print out a short summary with the "
          "found ResultStore links (if any).",
      )
      parser.add_argument(
          "-v",
          "--verbose",
          action="store_true",
          dest="verbose",
          default=False,
          help="Prints out lines helpful for debugging.",
      )
      parsed_args = parser.parse_args()
      if not parsed_args.print and not parsed_args.xml_out_path:
          raise TypeError(
              "`--print` or `--xml-out-path` must be specified"
          )
  
      return parsed_args
  
file_path: tensorflow-upstream/ci/official/utilities/extract_resultstore_links.py
imports: import argparse
  import datetime
  import os
  import re
  from typing import Dict, Union
  import xml.etree.ElementTree
label_desc: Use image node_id 1 for calling a global function with example usage: parse_args() and returns: parsed_args