def validate_python(self, value, state): if value == '': raise Invalid(self.message("empty", state), value, state) else: _, _, domain_name = value.rpartition('@') if EmailDomain.is_public(domain_name.strip()): raise Invalid(self.message("public", state), value, state)