human
Complete this python program:
def _AddSerializeToStringMethod(message_descriptor, cls):
assistant
#Here is the Python program you requested.

    """Helper for _AddMessageMethods().
    """
    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