code: def is_dtensor(tensor) -> bool:
      """Check whether the input tensor is a DTensor.
  
      In Python, a DTensor has the same type as a `tf.Tensor`. This method will
      let you check and handle the tensor differently if a tf.Tensor is a DTensor.
  
      Args:
        tensor: an object to be checked.
  
      Returns:
        bool, True if the given tensor is a DTensor.
      """
      return _dtensor_device().is_dtensor(tensor)
  
imports: import contextlib
  import threading
  from typing import Any, Callable, Optional, Sequence
  from tensorflow.dtensor.python import dtensor_device
  from tensorflow.dtensor.python import gen_dtensor_ops
  from tensorflow.dtensor.python import layout
  from tensorflow.python.eager import context
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.util import deprecation
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 6 for calling a global function with example usage: is_dtensor(tensor) and returns: _dtensor_device