<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean(self):
 """ Cleans the data and throws ValidationError on failure """

        errors = {}
        cleaned = {}

        for name, validator in self.validate_schema.items():
            val = getattr(self, name, None)
            try:
                cleaned[name] = validator.to_python(val)
            except formencode.api.Invalid, err:
                errors[name] = err

        if errors:
            raise ValidationError('Invalid data', errors)
        return cleaned