human
I wrote the below code

    nb_shutdown_processes = [0]
    def shutdown_one_process():
        'Tell    a    worker    to    terminate,    which    will    in    turn    wake    us    again'
        call_queue.put(None)
        nb_shutdown_processes[0] += 1
    while True:
        _add_call_item_to_queue(pending_work_items, work_ids_queue, call_queue)
        result_item = result_queue.get(block=True)
        if (result_item is not None):
            work_item = pending_work_items[result_item.work_id]
            del pending_work_items[result_item.work_id]
            if result_item.exception:
                work_item.future.set_exception(result_item.exception)
            else:
                work_item.future.set_result(result_item.result)
            del work_item
        executor = executor_reference()
        if (_shutdown or (executor is None) or executor._shutdown_thread):
            if (not pending_work_items):
                while (nb_shutdown_processes[0] < len(processes)):
                    shutdown_one_process()
                for p in processes:
                    p.join()
                call_queue.close()
                return
        del executor

What's a good function header?
assistant
#Here's a good function header.

def _queue_management_worker(executor_reference, processes, pending_work_items, work_ids_queue, call_queue, result_queue):