code: def is_extension_type(tensor):
      """Returns whether a tensor is of an ExtensionType.
  
      github.com/tensorflow/community/pull/269
      Currently it works by checking if `tensor` is a `CompositeTensor` instance,
      but this will be changed to use an appropriate extensiontype protocol
      check once ExtensionType is made public.
  
      Args:
        tensor: An object to test
  
      Returns:
        True if the tensor is an extension type object, false if not.
      """
      return isinstance(tensor, composite_tensor.CompositeTensor)
  
imports: import collections
  import copy
  import numpy
  from tensorflow.python.data.experimental.ops import cardinality
  from tensorflow.python.distribute.coordinator import cluster_coordinator
  from tensorflow.python.eager import context
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.framework import type_spec
  from tensorflow.python.keras import backend
  from tensorflow.python.keras.engine import keras_tensor
  from tensorflow.python.keras.utils import object_identity
  from tensorflow.python.keras.utils import tf_contextlib
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.ops.ragged import ragged_tensor_value
  from tensorflow.python.util import nest
label_desc: Use image node_id 9 for calling a global function with example usage: is_extension_type(tensor) and returns: isinstance