<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate(self, data=None):
 """ Validate the data Check also that no extra properties are present. :raises: ValidationError if the data is not valid. """


        errors = {}

        data = self._getData(data)

        # validate each field, one by one
        for name, field in self.fields.items():
            try:
                field.clean(data.get(name))
            except ValidationError, e:
                errors[name] = e.messages
            except AttributeError, e:
                raise ValidationError('data should be of type dict but is %s' % (type(data),))

        # check for extra fields
        extras = set(data.keys()) - set(self.fields.keys())
        if extras:
            errors[', '.join(extras)] = ['field(s) not allowed']

        # if errors, raise ValidationError
        if errors:
            raise ValidationError(errors)