code: def stop(self):
          
          logger.debug('Stopping')
          self._closing = True
          self.stop_consuming()
          self._connection.ioloop.start()
          logger.debug('Stopped')
docs: Cleanly shutdown the connection to RabbitMQ by stopping the
          consumer with RabbitMQ.
  
          When RabbitMQ confirms the cancellation, on_cancelok will be invoked
          by pika, which will then closing the channel and connection.
  
          The IOLoop is started again, becuase this method is invoked when
          an exception is raised. This exception stops the IOLoop which needs
          to be running for pika to communicate with RabbitMQ. All of the
          commands issued prior to starting the IOLoop will be buffered but
          not processed.