'Cancel consumer by consumer tag.
Request the consumer stops reading messages from its queue. The
consumer is a :class:`~qpid.messaging.endpoints.Receiver`, and it is
closed using :meth:`~qpid.messaging.endpoints.Receiver.close`.
This method also cleans up all lingering references of the consumer.
:param consumer_tag: The tag which refers to the consumer to be
cancelled. Originally specified when the consumer was created
as a parameter to :meth:`basic_consume`.
:type consumer_tag: an immutable object'

def basic_cancel(self, consumer_tag):

    if (consumer_tag in self._receivers):
        receiver = self._receivers.pop(consumer_tag)
        receiver.close()
        queue = self._tag_to_queue.pop(consumer_tag, None)
        self.connection._callbacks.pop(queue, None)
