docs: def _ensure_connection(self):
          """Make certain we have a valid connection and return it."""
          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