code: def testRegisterCustomCodec(self):
      class MyObject(object):
          pass
  
      class MyObjectCodec(object):
          """Codec for MyObject."""
  
          def can_encode(self, pyobj):
              return isinstance(pyobj, MyObject)
  
          def do_encode(self, array, encode_fn):
              del array, encode_fn
              return struct_pb2.StructuredValue()
  
          def can_decode(self, value):
              del value
              return False
  
          def do_decode(self, value, decode_fn):
              raise NotImplementedError("Test only.")
  
      nested_structure_coder.register_codec(MyObjectCodec())
      my_object = MyObject()
      self.assertTrue(nested_structure_coder.can_encode(my_object))
  
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 22 for calling the NestedStructureCoderTest obj's underlying member method code with example usage: obj.testRegisterCustomCodec() and returns: isinstance, struct_pb2, False