'Make certain we have a valid connection and return it.'

def _ensure_connection(self):

    conn = self.connect()
    if (conn.recycle and (conn.recycle < time.time())):
        logger.debug('Client    session    expired    after    %is.    Recycling.', self._recycle)
        self.close()
        conn = self.connect()
    return conn
