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
Make certain we have a valid connection and return it.
dataset/ETHPy150Open aparo/pyes/pyes/connection.py/ThreadLocalConnection._ensure_connection