code: def register_serializable(
      package="Custom", name=None, predicate=None
  ):  # pylint: disable=unused-argument
      """Decorator for registering a serializable class.
  
      THIS METHOD IS STILL EXPERIMENTAL AND MAY CHANGE AT ANY TIME.
  
      Registered classes will be saved with a name generated by combining the
      `package` and `name` arguments. When loading a SavedModel, modules saved with
      this registered name will be created using the `_deserialize_from_proto`
      method.
  
      By default, only direct instances of the registered class will be saved/
      restored with the `serialize_from_proto`/`deserialize_from_proto` methods. To
      extend the registration to subclasses, use the `predicate argument`:
  
      ```python
      class A(tf.Module):
        pass
  
      register_serializable(
          package="Example", predicate=lambda obj: isinstance(obj, A))(A)
      ```
  
      Args:
        package: The package that this class belongs to.
        name: The name to serialize this class under in this package. If None, the
          class's name will be used.
        predicate: An optional function that takes a single Trackable argument, and
          determines whether that object should be serialized with this `package`
          and `name`. The default predicate checks whether the object's type exactly
          matches the registered class. Predicates are executed in the reverse order
          that they are added (later registrations are checked first).
  
      Returns:
        A decorator that registers the decorated class with the passed names and
        predicate.
      """
  
      def decorator(arg):
          """Registers a class with the serialization framework."""
          nonlocal predicate
          if not tf_inspect.isclass(arg):
              raise TypeError(
                  "Registered serializable must be a class: {}".format(
                      arg
                  )
              )
  
          class_name = name if name is not None else arg.__name__
          if predicate is None:
              predicate = lambda x: isinstance(x, arg)
          _class_registry.register(package, class_name, predicate, arg)
          return arg
  
      return decorator
  
imports: import collections
  import re
  from absl import logging
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 3 for calling a global function with example usage: register_serializable(package, name, predicate) and returns: decorator, arg