'Main Zookeeper handling loop'

def zk_loop(self):

    self.logger.log(BLATHER, 'ZK    loop    started')
    self.connection_stopped.clear()
    retry = self.retry_sleeper.copy()
    try:
        while (not self.client._stopped.is_set()):
            if (retry(self._connect_loop, retry) is STOP_CONNECTING):
                break
    except RetryFailedError:
        self.logger.warning('Failed    connecting    to    Zookeeper    within    the    connection    retry    policy.')
    finally:
        self.connection_stopped.set()
        self.client._session_callback(KeeperState.CLOSED)
        self.logger.log(BLATHER, 'Connection    stopped')
