code: def parse_xml_report(
      tag: str,
      report: Path,
      workflow_id: int,
      workflow_run_attempt: int,
  ) -> List[Dict[str, Any]]:
      """Convert a test report xml file into a JSON-serializable list of test cases."""
      print(f"Parsing {tag}s for test report: {report}")
  
      job_id = get_job_id(report)
      print(f"Found job id: {job_id}")
  
      test_cases: List[Dict[str, Any]] = []
  
      root = ET.parse(report)
      for test_case in root.iter(tag):
          case = process_xml_element(test_case)
          case["workflow_id"] = workflow_id
          case["workflow_run_attempt"] = workflow_run_attempt
          case["job_id"] = job_id
  
          # [invoking file]
          # The name of the file that the test is located in is not necessarily
          # the same as the name of the file that invoked the test.
          # For example, `test_jit.py` calls into multiple other test files (e.g.
          # jit/test_dce.py). For sharding/test selection purposes, we want to
          # record the file that invoked the test.
          #
          # To do this, we leverage an implementation detail of how we write out
          # tests (https://bit.ly/3ajEV1M), which is that reports are created
          # under a folder with the same name as the invoking file.
          case["invoking_file"] = report.parent.name
          test_cases.append(case)
  
      return test_cases
  
file_path: pytorch/tools/stats/upload_test_stats.py
imports: import argparse
  import os
  import sys
  import xml.etree.ElementTree
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Any, Dict, List, Optional
  from tools.stats.upload_stats_lib import download_gha_artifacts, download_s3_artifacts, unzip, upload_workflow_stats_to_s3
label_desc: Use image node_id 2 for calling a global function with example usage: parse_xml_report(tag, report, workflow_id, workflow_run_attempt) and returns: test_cases