parameters: (message_descriptor, cls)
docstring: Helper for _AddMessageMethods().
docstring_summary: Helper for _AddMessageMethods().
docstring_tokens: Helper for _AddMessageMethods () .
function: def _AddSerializeToStringMethod(message_descriptor, cls):
    """Helper for _AddMessageMethods()."""
  
    def SerializeToString(self):
      # Check if the message has all of its required fields set.
      errors = []
      if not self.IsInitialized():
        raise message_mod.EncodeError(
            'Message is missing required fields: ' +
            ','.join(self.FindInitializationErrors()))
      return self.SerializePartialToString()
    cls.SerializeToString = SerializeToString
function_tokens: def _AddSerializeToStringMethod ( message_descriptor , cls ) : def SerializeToString ( self ) : # Check if the message has all of its required fields set. errors = [ ] if not self . IsInitialized ( ) : raise message_mod . EncodeError ( 'Message is missing required fields: ' + ',' . join ( self . FindInitializationErrors ( ) ) ) return self . SerializePartialToString ( ) cls . SerializeToString = SerializeToString