code: def wait_for_tasks(self):
          
          finished_tasks_and_results = []
          while len(finished_tasks_and_results) == 0:
              if self.is_done():
                  break
              self.start_tasks()
              self.process_all_messages_in_queue()
              finished_tasks_and_results = self.get_finished_results()
          return finished_tasks_and_results
docs: Wait for one or more tasks to finish or return empty list if we are done.
          Starts new tasks if we have less than task_at_once currently running.
          :return: [(Task,object)]: list of (task,result) for finished tasks