'Validate the domain part of the email address. Return True if
valid and False otherwise.'

def validate_domain_part(self, domain_part):

    if (domain_part in self.domain_whitelist):
        return True
    if self.DOMAIN_REGEX.match(domain_part):
        return True
    if (self.allow_ip_domain and (domain_part[0] == '[') and (domain_part[(-1)] == ']')):
        for addr_family in (socket.AF_INET, socket.AF_INET6):
            try:
                socket.inet_pton(addr_family, domain_part[1:(-1)])
                return True
            except (socket.error, UnicodeEncodeError):
                pass
    return False
