code: def reroute_error():
      """Temporarily reroute errors written to tf_logging.error into `captured`."""
      with test.mock.patch.object(
          tf_should_use.tf_logging, "error"
      ) as error:
          yield error
  
imports: import contextlib
  import gc
  import sys
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import tf_should_use
label_desc: Use image node_id 1 for calling a global function with example usage: reroute_error() without return types