def _AddSerializeToStringMethod(message_descriptor, cls):
 def SerializeToString(self):
  errors = []
  if (not self.IsInitialized()):
   raise message_mod.EncodeError(('Message %s is missing required fields: %s' % (self.DESCRIPTOR.full_name, ','.join(self.FindInitializationErrors()))))
  return self.SerializePartialToString()
 cls.SerializeToString = SerializeToString

def _AddSerializeToStringMethod ( message_descriptor , cls ) : def SerializeToString ( self ) : errors = [ ] if ( not self . IsInitialized ( ) ) : raise message_mod . EncodeError ( ( 'Message %s is missing required fields: %s' % ( self . DESCRIPTOR . full_name , ',' . join ( self . FindInitializationErrors ( ) ) ) ) ) return self . SerializePartialToString ( ) cls . SerializeToString = SerializeToString
helper for _addmessagemethods() .