def read_inet(f):
    size = read_byte(f)
    addrbytes = f.read(size)
    port = read_int(f)
    if size == 4:
        addrfam = socket.AF_INET
    elif size == 16:
        addrfam = socket.AF_INET6
    else:
        raise InternalError("bad inet address: %r" % (addrbytes,))
    return (util.inet_ntop(addrfam, addrbytes), port)
dataset/ETHPy150Open datastax/python-driver/cassandra/protocol.py/read_inet/original