human
I wrote the below code

    children = (children or [])
    process_list = []
    def on_process_terminated(proc):
        if proc.returncode:
            log.info('Process    %s    terminated    with    exit    code:    %s', getattr(proc, '_cmdline', proc), proc.returncode)
        else:
            log.info('Process    %s    terminated', getattr(proc, '_cmdline', proc))
    if (pid and (not process)):
        try:
            process = psutil.Process(pid)
            process_list.append(process)
        except psutil.NoSuchProcess:
            process = None
    if kill_children:
        if process:
            if (not children):
                children = collect_child_processes(process.pid)
            else:
                children.extend(collect_child_processes(pid))
        if children:
            process_list.extend(children)
    if process_list:
        if process:
            log.info('Stopping    process    %s    and    respective    children:    %s', process, children)
        else:
            log.info('Terminating    process    list:    %s', process_list)
        terminate_process_list(process_list, kill=(slow_stop is False), slow_stop=slow_stop)
        if (process and psutil.pid_exists(process.pid)):
            log.warning('Process    left    behind    which    we    were    unable    to    kill:    %s', process)

What's a good function header?

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

def terminate_process(pid=None, process=None, children=None, kill_children=False, slow_stop=False):