code: def _is_in_test():
      global _in_test
  
      if _in_test is None:
          _in_test = any(
              env_var in os.environ
              # These environment variables are always set by pytest and Buildkite,
              # respectively.
              for env_var in ("PYTEST_CURRENT_TEST", "BUILDKITE")
          )
      return _in_test
  
imports: from dataclasses import dataclass
  import logging
  import os
  import sys
  from typing import List, Tuple, Optional, TYPE_CHECKING
label_desc: Use image node_id 1 for calling a global function with example usage: _is_in_test() and returns: _in_test