code: def detect_runner():
      """Guess which test runner we're using by traversing the stack and looking
      for the first matching module. This *should* be reasonably safe, as
      it's done during test discovery where the test runner should be the
      stack frame immediately outside."""
      if _test_runner_override is not None:
          return _test_runner_override
      global _test_runner_guess
      if _test_runner_guess is False:
          stack = inspect.stack()
          for record in reversed(stack):
              frame = record[0]
              module = frame.f_globals.get("__name__").partition(".")[0]
              if module in _test_runner_aliases:
                  module = _test_runner_aliases[module]
              if module in _test_runners:
                  _test_runner_guess = module
                  break
              if record[1].endswith("python2.6/unittest.py"):
                  _test_runner_guess = "unittest"
                  break
          else:
              _test_runner_guess = None
      return _test_runner_guess
  
imports: import re
  import sys
  import inspect
  import warnings
  from typing import Iterable
  from functools import wraps
  from types import MethodType
  from collections import namedtuple
  from unittest import TestCase
label_desc: Use image node_id 11 for calling a global function with example usage: detect_runner() and returns: _test_runner_guess, _test_runner_override