This method connects to RabbitMQ using a SelectConnection object,
        returning the connection handle.

        When the connection is established, the on_connection_open method
        will be invoked by pika.

        :rtype: pika.SelectConnection

def connect(self):
        """This method connects to RabbitMQ using a SelectConnection object,
        returning the connection handle.

        When the connection is established, the on_connection_open method
        will be invoked by pika.

        :rtype: pika.SelectConnection

        """

        count = 1
        no_of_servers = len(self._rabbit_urls)

        while True:
            server_choice = (count % no_of_servers) - 1

            self._url = self._rabbit_urls[server_choice]

            try:
                logger.info('Connecting', attempt=count)
                return pika.SelectConnection(pika.URLParameters(self._url),
                                             self.on_connection_open,
                                             stop_ioloop_on_close=False)
            except pika.exceptions.AMQPConnectionError:
                logger.exception("Connection error")
                count += 1
                logger.error("Connection sleep", no_of_seconds=count)
                time.sleep(count)

                continue