def clean(self):
        cleaned_data = super(UserProfileFormRegister, self).clean()

        # don't check captcha if it's disabled
        if not self.REGISTRATION_REQUIRE_CAPTCHA:
            if 'recaptcha_response_field' in self._errors:
                del self._errors['recaptcha_response_field']
            return cleaned_data

        response = captcha.submit(
            cleaned_data.get('recaptcha_challenge_field'),
            cleaned_data.get('recaptcha_response_field'),
            settings.RECAPTCHA_PRIVATE_KEY,
            None)

        if not response.is_valid:
            raise forms.ValidationError(_(u"The Captcha is invalid. "
                                          u"Please, try again."))
        return cleaned_data

    # This code use to be in clean_username. Now clean_username is just
    # a convenience proxy to this method. This method is here to allow
    # the UserProfileSerializer to validate the username without reinventing
    # the wheel while still avoiding the need to instancate the form. A even
    # cleaner way would be a shared custom validator.
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/main/forms.py/RegistrationFormUserProfile.clean/original