code: def _enclosing_tpu_context():
      # pylint: disable=protected-access
      context = ops.get_default_graph()._get_control_flow_context()
      # pylint: enable=protected-access
      while context is not None and not isinstance(
          context, control_flow_ops.XLAControlFlowContext
      ):
          context = context.outer_context
      return context
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  import inspect
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_conversion_registry
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import gen_resource_variable_ops
label_desc: Use image node_id 2 for calling a global function with example usage: _enclosing_tpu_context() and returns: context