def connect(sock, addr):
    """Connect to some addr."""
    try:
        sock.connect(addr)
    except ssl.SSLError as e:
        return (ssl.SSLError, e.strerror if e.strerror else e.message)
    except socket.herror as (_, msg):
        return (socket.herror, msg)
    except socket.gaierror as (_, msg):
        return (socket.gaierror, msg)
    except socket.timeout:
        return (socket.timeout, "timeout")
    except socket.error as e:
        return (socket.error, e.strerror if e.strerror else e.message)
    
    return None
def connect ( sock , addr ) : try : sock . connect ( addr ) except ssl . SSLError as e : return ( ssl . SSLError , e . strerror if e . strerror else e . message ) except socket . herror as ( _ , msg ) : return ( socket . herror , msg ) except socket . gaierror as ( _ , msg ) : return ( socket . gaierror , msg ) except socket . timeout : return ( socket . timeout , "timeout" ) except socket . error as e : return ( socket . error , e . strerror if e . strerror else e . message ) return None
Connect to some addr.