code: def is_nested(modality, structure):
      """Returns true if its input is a nested structure.
  
      For Modality.CORE refer to
      [tf.nest](https://www.tensorflow.org/api_docs/python/tf/nest)
      for the definition of a nested structure.
  
      Args:
        modality: enum value of supported modality [Modality.CORE or Modality.DATA]
        structure: the value to test.
  
      Returns:
        True if the input is a nested structure.
      """
      if modality == Modality.CORE:
          return _tf_core_is_nested(structure)
      elif modality == Modality.DATA:
          return _tf_data_is_nested(structure)
      else:
          raise ValueError(
              "Unknown modality used {} for nested structure".format(
                  modality
              )
          )
  
imports: import collections
  import enum
  import wrapt
  from tensorflow.python import pywrap_tensorflow
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import _pywrap_utils
  from tensorflow.python.util.compat import collections_abc
  from tensorflow.python.util.custom_nest_protocol import CustomNestProtocol
label_desc: Use image node_id 1 for calling a global function with example usage: is_nested(modality, structure) and returns: _tf_core_is_nested, _tf_data_is_nested