'This method cancels a consumer. This does not affect already
delivered messages, but it does mean the server will not send any more
messages for that consumer. The client may receive an arbitrary number
of messages in between sending the cancel method and receiving the
cancel-ok reply. It may also be sent from the server to the client in
the event of the consumer being unexpectedly cancelled (i.e. cancelled
for any reason other than the server receiving the corresponding
basic.cancel from the client). This allows clients to be notified of
the loss of consumers due to events such as queue deletion.
:param callable callback: Callback to call for a Basic.CancelOk
response; MUST be None when nowait=True. MUST be callable when
nowait=False.
:param str consumer_tag: Identifier for the consumer
:param bool nowait: Do not expect a Basic.CancelOk response
:raises ValueError:'

def basic_cancel(self, callback=None, consumer_tag='', nowait=False):

    self._validate_channel_and_callback(callback)
    if nowait:
        if (callback is not None):
            raise ValueError('Completion    callback    must    be    None    when    nowait=True')
    elif (callback is None):
        raise ValueError('Must    have    completion    callback    with    nowait=False')
    if (consumer_tag in self._cancelled):
        LOGGER.warning('basic_cancel    -    consumer    is    already    cancelling:    %s', consumer_tag)
        return
    if (consumer_tag not in self._consumers):
        LOGGER.warning('basic_cancel    -    consumer    not    found:    %s', consumer_tag)
        return
    LOGGER.debug('Cancelling    consumer:    %s    (nowait=%s)', consumer_tag, nowait)
    if nowait:
        del self._consumers[consumer_tag]
    if (callback is not None):
        if nowait:
            raise ValueError('Cannot    pass    a    callback    if    nowait    is    True')
        self.callbacks.add(self.channel_number, spec.Basic.CancelOk, callback)
    self._cancelled.add(consumer_tag)
    self._rpc(spec.Basic.Cancel(consumer_tag=consumer_tag, nowait=nowait), (self._on_cancelok if (not nowait) else None), ([(spec.Basic.CancelOk, {'consumer_tag': consumer_tag})] if (nowait is False) else []))
