code: def testEncodeDecodeExtensionTypeSpec(self):
      class Zoo(extension_type.ExtensionType):
          __name__ = "tf.nested_structure_coder_test.Zoo"
          zookeepers: typing.Tuple[str, ...]
          animals: typing.Mapping[str, tensor.Tensor]
  
      structure = [
          Zoo.Spec(
              zookeepers=["Zoey", "Zack"],
              animals={"tiger": tensor.TensorSpec([16])},
          )
      ]
  
      self.assertTrue(nested_structure_coder.can_encode(structure))
      encoded = nested_structure_coder.encode_structure(structure)
      expected_pbtxt = r"""
      list_value {
        values {
          type_spec_value {
            type_spec_class: EXTENSION_TYPE_SPEC
            type_spec_class_name: "tf.nested_structure_coder_test.Zoo.Spec"
            num_flat_components: 1
            type_state {
              tuple_value {
                values {
                  tuple_value {
                    values { string_value: "zookeepers" }
                    values { tuple_value {
                      values { string_value: "Zoey" }
                      values { string_value: "Zack" } } } } }
                values {
                  tuple_value {
                    values { string_value: "animals" }
                    values { dict_value {
                      fields {
                        key: "tiger"
                        value { tensor_spec_value {
                          shape { dim { size: 16 } }
                          dtype: DT_FLOAT } } } } } } } } } } } }
      """
      expected = struct_pb2.StructuredValue()
      text_format.Parse(expected_pbtxt, expected)
      self.assertEqual(expected, encoded)
      decoded = nested_structure_coder.decode_proto(encoded)
      self.assertEqual(structure, decoded)
  
imports: import collections
  import typing
  import warnings
  import numpy
  from google.protobuf import text_format
  from tensorflow.core.protobuf import struct_pb2
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import extension_type
  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 test_util
  from tensorflow.python.framework import type_spec
  from tensorflow.python.framework import type_spec_registry
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import test
  from tensorflow.python.saved_model import nested_structure_coder
  from tensorflow.python.types import internal
label_desc: Use image node_id 14 for calling the NestedStructureCoderTest obj's underlying member method code with example usage: obj.testEncodeDecodeExtensionTypeSpec() without return types