code: def run_bazel_query(query: str, debug: bool) -> ET.Element:
      """Runs bazel query with XML output format.
  
      We need the XML to obtain rule metadata such as
      size, timeout, etc.
      """
      args = ["bazel", "query", "--output=xml", query]
      if debug:
          print(f"$ {args}", file=sys.stderr)
          sys.stderr.flush()
      p = subprocess.run(
          args,
          check=True,
          stdout=subprocess.PIPE,
          errors="replace",
          universal_newlines=True,
      )
      output = p.stdout.strip()
      return ET.fromstring(output) if output else None
  
imports: from collections import defaultdict
  from dataclasses import dataclass
  from typing import Iterable, List, Optional, Set, Tuple
  import argparse
  import os
  import re
  import shlex
  import subprocess
  import sys
  import xml.etree.ElementTree
label_desc: Use image node_id 6 for calling a global function with example usage: run_bazel_query(query, debug) and returns: unknown