#NEWLINE# def _list_generator( inst , firstgetter , nextgetter , statusfilt = None ) : #NEWLINE# #INDENT# if inst : #NEWLINE# #INDENT# next = firstgetter ( inst ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# next = firstgetter ( ) #NEWLINE# #UNINDENT# if ( not next ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# ( yield next ) #NEWLINE# while 1 : #NEWLINE# #INDENT# next = nextgetter ( next ) #NEWLINE# if ( not next ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if statusfilt : #NEWLINE# #INDENT# if ( next . status == statusfilt ) : #NEWLINE# #INDENT# ( yield next ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( yield next )