def __call__(self, value):
        if not settings.USERS_VALIDATE_EMAIL_DOMAIN:  # pragma: no cover
            return

        if not value or '@' not in value:
            raise forms.ValidationError(_('Enter a valid email address.'), code=self.code)

        value = force_text(value)
        user_part, domain_part = value.rsplit('@', 1)

        if self.domain_blacklist and domain_part in self.domain_blacklist:
            raise forms.ValidationError(self.message % domain_part, code=self.code)

        if self.domain_whitelist and domain_part not in self.domain_whitelist:
            raise forms.ValidationError(self.message % domain_part, code=self.code)
dataset/ETHPy150Open mishbahr/django-users2/users/fields.py/EmailDomainValidator.__call__/original