#NEWLINE# def collect_replies( conn , channel , queue , * args , **kwargs ) : #NEWLINE# #INDENT# 'Generator collecting replies from ``queue``' #NEWLINE# no_ack = kwargs . setdefault ( 'no_ack' , True ) #NEWLINE# received = False #NEWLINE# try : #NEWLINE# #INDENT# for ( body , message ) in itermessages ( conn , channel , queue , * args , ** kwargs ) : #NEWLINE# #INDENT# if ( not no_ack ) : #NEWLINE# #INDENT# message . ack ( ) #NEWLINE# #UNINDENT# received = True #NEWLINE# ( yield body ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# if received : #NEWLINE# #INDENT# channel . after_reply_message_received ( no_ack . name )