'Return an item from the pool, when one is available.
This may cause the calling greenthread to block. Check if a
connection is active before returning it.
For dead connections create and return a new connection.'

def get(self):

    conn = super(SSHPool, self).get()
    if conn:
        if conn.get_transport().is_active():
            return conn
        else:
            conn.close()
    try:
        new_conn = self.create()
    except Exception:
        LOG.error('Create    new    item    in    SSHPool    failed.')
        with excutils.save_and_reraise_exception():
            if conn:
                self.current_size -= 1
    return new_conn
