code: def to_protobuf(self):
          
          self._validate()
          kwargs = {k: _convert(getattr(self, k), 'to_protobuf')
                    for k in self._get_params()}
          return self._protobuf_cls(**kwargs)
docs: Convert object to a protobuf message