code: def run_single_test(
      test_name: TestName, runtests: RunTests
  ) -> TestResult:
      """Run a single test.
  
      test_name -- the name of the test
  
      Returns a TestResult.
  
      If runtests.use_junit, xml_data is a list containing each generated
      testsuite element.
      """
      start_time = time.perf_counter()
      result = TestResult(test_name)
      pgo = runtests.pgo
      try:
          _runtest(result, runtests)
      except:
          if not pgo:
              msg = traceback.format_exc()
              print(
                  f"test {test_name} crashed -- {msg}",
                  file=sys.stderr,
                  flush=True,
              )
          result.state = State.UNCAUGHT_EXC
  
      sys.stdout.flush()
      sys.stderr.flush()
  
      result.duration = time.perf_counter() - start_time
      return result
  
imports: import faulthandler
  import gc
  import importlib
  import io
  import sys
  import time
  import traceback
  import unittest
  from test import support
  from test.support import threading_helper
  from .filter import match_test
  from .result import State, TestResult, TestStats
  from .runtests import RunTests
  from .save_env import saved_test_environment
  from .setup import setup_tests
  from .testresult import get_test_runner
  from .utils import TestName, clear_caches, remove_testfn, abs_module_name, print_warning
label_desc: Use image node_id 8 for calling a global function with example usage: run_single_test(test_name, runtests) and returns: result