'Clone of the very top of Paramiko 1.7.6 SSHClient.connect().
We must use this in order to make sure that our address family matches
up with the client side (which we cannot control, and which varies
depending on individual computers and their network settings).'

def _socket_info(self, addr_tup):

    (hostname, port) = addr_tup
    addr_info = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
    for (family, socktype, proto, canonname, sockaddr) in addr_info:
        if (socktype == socket.SOCK_STREAM):
            af = family
            addr = sockaddr
            break
    else:
        (af, _, _, _, addr) = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
    return (af, addr)
