'A factory function which returns connections which have
succeeded in connecting and are ready for service (or
raises an exception otherwise).'

@classmethod
def factory(cls, host, timeout, *args, **kwargs):

    start = time.time()
    kwargs['connect_timeout'] = timeout
    conn = cls(host, *args, **kwargs)
    elapsed = (time.time() - start)
    conn.connected_event.wait((timeout - elapsed))
    if conn.last_error:
        if conn.is_unsupported_proto_version:
            raise ProtocolVersionUnsupported(host, conn.protocol_version)
        raise conn.last_error
    elif (not conn.connected_event.is_set()):
        conn.close()
        raise OperationTimedOut(('Timed    out    creating    connection    (%s    seconds)' % timeout))
    else:
        return conn
