'Cancel all consumers.
NOTE: pending non-ackable messages will be lost; pending ackable
messages will be rejected.'

def _cancel_all_consumers(self):

    if self._consumer_infos:
        LOGGER.debug('Cancelling    %i    consumers', len(self._consumer_infos))
        if (self._queue_consumer_generator is not None):
            self.cancel()
        for consumer_tag in pika.compat.dictkeys(self._consumer_infos):
            self.basic_cancel(consumer_tag)
