code: def _enclosing_tpu_device_assignment() -> (
      Optional[device_assignment_lib.DeviceAssignment]
  ):
      if not distribute_lib.has_strategy():
          return None
      strategy = distribute_lib.get_strategy()
      if not is_tpu_strategy(strategy):
          return None
      return strategy.extended._device_assignment
  
imports: from typing import Any, Callable, List, Optional, Text, Tuple, Union
  from absl import logging
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.framework import device
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import func_graph
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.tpu import device_assignment
  from tensorflow.python.tpu.ops import tpu_ops
  from tensorflow.python.types import core
  from tensorflow.python.util import compat
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling a global function with example usage: _enclosing_tpu_device_assignment() and returns: strategy, None, None