code: def connect(self, nice_quit_ev):
           
  
          _logger.debug("Connecting to discovered node: [%s]", self.server_host)
  
          stop_epoch = time.time() + \
                          nsq.config.client.MAXIMUM_CONNECT_ATTEMPT_PERIOD_S
  
          timeout_s = nsq.config.client.INITIAL_CONNECT_FAIL_WAIT_S
          backoff_rate = nsq.config.client.CONNECT_FAIL_WAIT_BACKOFF_RATE
  
          while stop_epoch >= time.time() and nice_quit_ev.is_set() is False:
              try:
                  c = self.primitive_connect()
              except gevent.socket.error:
                  _logger.exception("Could not connect to discovered server: "
                                    "[%s]", self.server_host)
              else:
                  _logger.info("Discovered server-node connected: [%s]", 
                               self.server_host)
                  
                  return c
  
              timeout_s = min(timeout_s * backoff_rate,
                              nsq.config.client.MAXIMUM_CONNECT_FAIL_WAIT_S)
  
              _logger.info("Waiting for (%d) seconds before reconnecting.", 
                           timeout_s)
  
              gevent.sleep(timeout_s)
  
          raise nsq.exceptions.NsqConnectGiveUpError(
                  "Could not connect to the nsqlookupd server: [%s]" % 
                  (self.server_host,))
docs: Connect the server. We expect this to implement backoff and all 
          connection logistics for servers that were discovered via a lookup 
          node.