def clean(self):
        data = super(BaseCheckoutForm, self).clean()

        if data.get('email'):
            users = list(User.objects.filter(email=data.get('email')))

            if users:
                if self.request.user not in users:
                    if self.request.user.is_authenticated():
                        self._errors['email'] = self.error_class([
                            _('This e-mail address belongs to a different'
                                ' account.')])
                    else:
                        self._errors['email'] = self.error_class([
                            _('This e-mail address might belong to you, but'
                                ' we cannot know for sure because you are'
                                ' not authenticated yet.')])

        return data
dataset/ETHPy150Open matthiask/plata/plata/shop/forms.py/BaseCheckoutForm.clean/original