code: def value_container(val):
      """Returns the container that this per-replica `value` belongs to.
  
      Args:
        val: A value returned by `call_for_each_replica()` or a variable created in
          `scope()`.
  
      Returns:
        A container that `value` belongs to.
        If value does not belong to any container (including the case of
        container having been destroyed), returns the value itself.
      """
      # DistributedVariable has _distributed_container defined but we don't want to
      # return it.
      container = None
      if not isinstance(val, values_lib.DistributedVariable):
          if hasattr(val, "_distributed_container"):
              container = (
                  val._distributed_container()
              )  # pylint: disable=protected-access
          elif (
              isinstance(val, composite_tensor.CompositeTensor)
              and hasattr(val, "handle")
              and hasattr(val.handle, "_distributed_container")
          ):
              # For ResourceVariables, the _distributed_container attribute
              # is added to their handle tensors.
              container = (
                  val.handle._distributed_container()
              )  # pylint: disable=protected-access
      return container if container is not None else val
  
imports: from collections import abc
  import contextlib
  import threading
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import tpu_values
  from tensorflow.python.distribute import values
  from tensorflow.python.distribute.reduce_util import ReduceOp
  from tensorflow.python.eager import context
  from tensorflow.python.eager import record
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops.losses import losses_impl
  from tensorflow.python.util import nest
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 7 for calling a global function with example usage: value_container(val) and returns: unknown