#NEWLINE# @ idiokit . stream #NEWLINE# def _cleanup( self , key ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( yield idiokit . consume ( ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# if self . counter . dec ( key ) : #NEWLINE# #INDENT# ( yield idiokit . sleep ( self . grace_period ) ) #NEWLINE# if ( ( not self . counter . contains ( key ) ) and ( key in self . tasks ) ) : #NEWLINE# #INDENT# task = self . tasks . pop ( key ) #NEWLINE# task . throw ( self . signal )