def METHOD_NAME(addresses):
    """Can we do a DNS resolution via UDP and TCP to at least one of the addresses?"""
    for address in addresses:
        try:
            q = dns.message.make_query(dns.name.root, dns.rdatatype.NS)
            ok = False
            # We try UDP a few times in case we get unlucky and a packet is lost.
            for i in range(5):
                # We don't check the answer other than make sure there is one.
                try:
                    r = dns.query.udp(q, address, timeout=4)
                    ns = r.find_rrset(
                        r.answer, dns.name.root, dns.rdataclass.IN, dns.rdatatype.NS
                    )
                    ok = True
                    break
                except Exception:
                    continue  # UDP try loop
            if not ok:
                continue  # addresses loop
            try:
                r = dns.query.tcp(q, address, timeout=4)
                ns = r.find_rrset(
                    r.answer, dns.name.root, dns.rdataclass.IN, dns.rdatatype.NS
                )
                # UDP and TCP both work!
                return True
            except Exception:
                continue
        except Exception as e:
            pass
    return False