#NEWLINE# def _on_ready_to_cancel( self , consumer_tag , nowait ) : #NEWLINE# #INDENT# LOGGER . debug ( 'Cancelling consumer' ) #NEWLINE# if ( consumer_tag in self . _consumers ) : #NEWLINE# #INDENT# del self . _consumers [ consumer_tag ] #NEWLINE# #UNINDENT# if nowait : #NEWLINE# #INDENT# self . write_frame ( spec . Basic . Cancel ( consumer_tag = consumer_tag , nowait = True ) ) #NEWLINE# return #NEWLINE# #UNINDENT# self . rpc ( spec . Basic . Cancel ( consumer_tag = consumer_tag ) )