#NEWLINE# def get_task( self , node ) : #NEWLINE# #INDENT# task = self . project . next_task ( ) #NEWLINE# if ( task is None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# tp_id = self . _tasks_pool . pop ( ) #NEWLINE# task = self . project [ tp_id ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# self . completed = True #NEWLINE# raise ApplicationCompletedError ( self ) #NEWLINE# #UNINDENT# #UNINDENT# task_id = task [ 'id' ] #NEWLINE# node . task_id = task_id #NEWLINE# self . _tasks_pool . add ( task_id ) #NEWLINE# return task