code: def reset_eager(fn):
      def wrapper(*args, **kwargs):
          try:
              return fn(*args, **kwargs)
          finally:
              # Reset the context.
              context._reset_jit_compiler_flags()
              context._reset_context()
              ops.enable_eager_execution_internal()
              assert context._context is not None
  
      return wrapper
  
imports: from absl.testing import parameterized
  from tensorflow.core.protobuf import cluster_pb2
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.core.protobuf import tensorflow_server_pb2
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import test
  from tensorflow.python.util import compat
label_desc: Use image node_id 1 for calling a global function with example usage: reset_eager(fn) and returns: wrapper, fn