code: def pytest_runtest_protocol(item):
      if (
          isinstance(item, TestCaseFunction)
          and "twisted.trial.unittest" in sys.modules
      ):
          ut = sys.modules["twisted.python.failure"]
          Failure__init__ = ut.Failure.__init__
          check_testcase_implements_trial_reporter()
  
          def excstore(
              self,
              exc_value=None,
              exc_type=None,
              exc_tb=None,
              captureVars=None,
          ):
              if exc_value is None:
                  self._rawexcinfo = sys.exc_info()
              else:
                  if exc_type is None:
                      exc_type = type(exc_value)
                  self._rawexcinfo = (exc_type, exc_value, exc_tb)
              try:
                  Failure__init__(
                      self,
                      exc_value,
                      exc_type,
                      exc_tb,
                      captureVars=captureVars,
                  )
              except TypeError:
                  Failure__init__(self, exc_value, exc_type, exc_tb)
  
          ut.Failure.__init__ = excstore
          yield
          ut.Failure.__init__ = Failure__init__
      else:
          yield
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  import traceback
  import _pytest._code
  import pytest
  from _pytest.compat import getimfunc
  from _pytest.config import hookimpl
  from _pytest.outcomes import fail
  from _pytest.outcomes import skip
  from _pytest.outcomes import xfail
  from _pytest.python import Class
  from _pytest.python import Function
label_desc: Use image node_id 4 for calling a global function with example usage: pytest_runtest_protocol(item) without return types