code: def cancel(self, consumer_tag='', nowait=True, consumer=None, cb=None):
          '''
          Cancel a consumer. Can choose to delete based on a consumer tag or
          the function which is consuming.  If deleting by function, take care
          to only use a consumer once per channel.
          '''
          if consumer:
              tag = self._lookup_consumer_tag_by_consumer(consumer)
              if tag:
                  consumer_tag = tag
  
          nowait = nowait and self.allow_nowait() and not cb
  
          args = Writer()
          args.write_shortstr(consumer_tag).\
              write_bit(nowait)
          self.send_frame(MethodFrame(self.channel_id, 60, 30, args))
  
          if not nowait:
              self._cancel_cb.append(cb)
              self.channel.add_synchronous_cb(self._recv_cancel_ok)
          else:
              self._purge_consumer_by_tag(consumer_tagf cancel(self, consumer_tag='', nowait=True, consumer=None, cb=None):
          '''
          Cancel a consumer. Can choose to delete based on a consumer tag or
          the function which is consuming.  If deleting by function, take care
          to only use a consumer once per channel.
          '''
          if consumer:
              tag = self._lookup_consumer_tag_by_consumer(consumer)
              if tag:
                  consumer_tag = tag
  
          nowait = nowait and self.allow_nowait() and not cb
  
          args = Writer()
          args.write_shortstr(consumer_tag).\
              write_bit(nowait)
          self.send_frame(MethodFrame(self.channel_id, 60, 30, args))
  
          if not nowait:
              self._cancel_cb.append(cb)
              self.channel.add_synchronous_cb(self._recv_cancel_ok)
          else:
              self._purge_consumer_by_tag(consumer_tag)
docs: Cancel a consumer. Can choose to delete based on a consumer tag or
          the function which is consuming.  If deleting by function, take care
          to only use a consumer once per channel.