code: def connect(self, retry=0, delay=0):
          
          if self.connected:
              self._LOG.debug("Connect called, but we are connected?")
              return
          if self._connecting:
              self._LOG.debug("Connect called, but we are already connecting.")
              return
          self._connecting = True
  
          if delay:
              self._LOG.debug("Delayed connect: %d seconds" % delay)
              self.emit(self.EVENT_RECONNECT, delay)
              self.sleep(delay)
  
          self._LOG.debug("Connect initiated.")
  
          for i, server_addr in enumerate(self.cm_servers):
              if retry and i > retry:
                  return False
  
              start = time()
  
              if self.connection.connect(server_addr):
                  break
  
              diff = time() - start
  
              self._LOG.debug("Failed to connect. Retrying...")
  
              if diff < 5:
                  self.sleep(5 - diff)
  
          self.current_server_addr = server_addr
          self.connected = True
          self.emit(self.EVENT_CONNECTED)
          self._recv_loop = gevent.spawn(self._recv_messages)
          self._connecting = False
          return True
docs: Initiate connection to CM. Blocks until connected unless ``retry`` is specified.
  
          :param retry: number of retries before returning. Unlimited when set to ``None``
          :type retry: :class:`int`
          :param delay: delay in secnds before connection attempt
          :type delay: :class:`int`
          :return: successful connection
          :rtype: :class:`bool`