def _add_call_item_to_queue(pending_work_items, work_ids, call_queue):
 while True:
  if call_queue.full():
   return
  try:
   work_id = work_ids.get(block=False)
  except queue.Empty:
   return
  else:
   work_item = pending_work_items[work_id]
   if work_item.future.set_running_or_notify_cancel():
    call_queue.put(_CallItem(work_id, work_item.fn, work_item.args, work_item.kwargs), block=True)
   else:
    del pending_work_items[work_id]
    continue

def _add_call_item_to_queue ( pending_work_items , work_ids , call_queue ) : while True : if call_queue . full ( ) : return try : work_id = work_ids . get ( block = False ) except queue . Empty : return else : work_item = pending_work_items [ work_id ] if work_item . future . set_running_or_notify_cancel ( ) : call_queue . put ( _CallItem ( work_id , work_item . fn , work_item . args , work_item . kwargs ) , block = True ) else : del pending_work_items [ work_id ] continue
fills call_queue with _workitems from pending_work_items .