human
Write me a the Python program you requested given the following:
Complete the below
def dnslib_resolve_over_tcp(query, dnsservers, timeout, **kwargs):

    ''''dns query over tcp'
    '''
assistant
#Here is the Python program you requested.
    if (not isinstance(query, (basestring, dnslib.DNSRecord))):
        raise TypeError('query    argument    requires    string/DNSRecord')
    blacklist = kwargs.get('blacklist', ())
    blacklist_prefix = tuple((x for x in blacklist if x.endswith('.')))
    def do_resolve(query, dnsserver, timeout, queobj):
        if isinstance(query, basestring):
            qtype = (dnslib.QTYPE.AAAA if (':' in dnsserver) else dnslib.QTYPE.A)
            query = dnslib.DNSRecord(q=dnslib.DNSQuestion(query, qtype=qtype))
        query_data = query.pack()
        sock_family = (socket.AF_INET6 if (':' in dnsserver) else socket.AF_INET)
        sock = socket.socket(sock_family)
        rfile = None
        try:
            sock.settimeout((timeout or None))
            sock.connect(parse_hostport(dnsserver, 53))
            sock.send((struct.pack('>h', len(query_data)) + query_data))
            rfile = sock.makefile('r', 1024)
            reply_data_length = rfile.read(2)
            if (len(reply_data_length) < 2):
                raise socket.gaierror(11004, ('getaddrinfo    %r    from    %r    failed' % (query.q.qname, dnsserver)))
            reply_data = rfile.read(struct.unpack('>h', reply_data_length)[0])
            record = dnslib.DNSRecord.parse(reply_data)
            iplist = [str(x.rdata) for x in record.rr if (x.rtype in (1, 28, 255))]
            if any((((x in blacklist) or x.startswith(blacklist_prefix)) for x in iplist)):
                logging.debug('qname=%r    dnsserver=%r    record    bad    iplist=%r', query.q.qname, dnsserver, iplist)
                raise socket.gaierror(11004, ('getaddrinfo    %r    from    %r    failed' % (query, dnsserver)))
            else:
                logging.debug('qname=%r    dnsserver=%r    record    iplist=%s', query.q.qname, dnsserver, iplist)
                queobj.put(record)
        except socket.error as e:
            logging.debug('qname=%r    dnsserver=%r    failed    %r', query.q.qname, dnsserver, e)
            queobj.put(e)
        finally:
            if...