code: def from_protobuf(cls, msg):
          
          if not isinstance(msg, cls._protobuf_cls):
              raise TypeError("Expected message of type "
                              "%r" % cls._protobuf_cls.__name__)
          kwargs = {k: getattr(msg, k) for k in cls._get_params()}
          return cls(**kwargs)
docs: Create an instance from a protobuf message.