code: def validate(self, message):
          
          for key, field in self.fields.items():
              if key not in message:
                  raise ValidationError(message, "Field %r is missing" % (key, ))
              field.validate(message[key])
  
          if self.allow_additional_fields:
              return
          # Otherwise, additional fields are not allowed:
          fieldSet = set(self.fields) | set(RESERVED_FIELDS)
          for key in message:
              if key not in fieldSet:
                  raise ValidationError(message, "Unexpected field %r" % (key, ))
docs: Validate the given message.
  
          @param message: A C{dict}.
  
          @raises ValidationError: If the message has the wrong fields or one of
              its field values fail validation.