def get_task(self, node):
        task = self.project.next_task()
        if task is None:
            try:
                tp_id = self._tasks_pool.pop()
                task = self.project[tp_id]
            except __HOLE__:
                # project depleted and nothing in the pool,
                # looks like the application has completed.
                self.completed = True
                raise ApplicationCompletedError(self)

        task_id = task['id']
        node.task_id = task_id
        self._tasks_pool.add(task_id)

        if self.temporal_storage.contains(task_id, node.id):
            raise NodeRequestRejectedError('The result of this task has been '
                                           'already accepted.')
        return task
dataset/ETHPy150Open BasicWolf/kaylee/kaylee/contrib/controllers.py/ResultsComparatorController.get_task