def execute_until_empty(taskqueue, queue='default', handlers_map=None):
 task_run_counts = collections.defaultdict((lambda : 0))
 while taskqueue.GetTasks(queue):
  new_counts = execute_all_tasks(taskqueue, queue, handlers_map)
  for handler_cls in new_counts:
   task_run_counts[handler_cls] += new_counts[handler_cls]
 return task_run_counts

def execute_until_empty ( taskqueue , queue = 'default' , handlers_map = None ) : task_run_counts = collections . defaultdict ( ( lambda : 0 ) ) while taskqueue . GetTasks ( queue ) : new_counts = execute_all_tasks ( taskqueue , queue , handlers_map ) for handler_cls in new_counts : task_run_counts [ handler_cls ] += new_counts [ handler_cls ] return task_run_counts
execute taskqueue tasks until it becomes empty .