code: def translate_classname(classname):
      # The pytest xunit output has "classname" in the python sense as 'dir.subdir.package.Class' -- we want to
      # convert that back in to a pytest "selector" of dir/subdir/package.py::Class
  
      if not classname:
          return None
  
      context = Path.cwd()
  
      parts = classname.split(".")
  
      for offset, component in enumerate(parts, 1):
          candidate = context / component
  
          if candidate.is_dir():
              context = candidate
          else:
              candidate = context / (component + ".py")
              if candidate.is_file():
                  context = candidate
              break
      parts = parts[offset:]
  
      val = str(context.relative_to(Path.cwd()))
  
      if parts:
          val += "::" + ".".join(parts)
      return val
  
file_path: airflow/scripts/ci/testing/summarize_junit_failures.py
imports: from __future__ import annotations
  import os
  import re
  import sys
  import xml.etree.ElementTree
  from functools import lru_cache
  from pathlib import Path
label_desc: Use image node_id 1 for calling a global function with example usage: translate_classname(classname) and returns: val, None