human
I wrote the below code

    if stem.util.system.is_windows():
        timeout = None
    if (os.path.sep in tor_cmd):
        if os.path.isdir(tor_cmd):
            raise OSError(("'%s'    is    a    directory,    not    the    tor    executable" % tor_cmd))
        elif (not os.path.isfile(tor_cmd)):
            raise OSError(("'%s'    doesn't    exist" % tor_cmd))
    elif (not stem.util.system.is_available(tor_cmd)):
        raise OSError(("'%s'    isn't    available    on    your    system.    Maybe    it's    not    in    your    PATH?" % tor_cmd))
    if ((torrc_path not in (None, NO_TORRC)) and (not os.path.exists(torrc_path))):
        raise OSError(("torrc    doesn't    exist    (%s)" % torrc_path))
    (runtime_args, temp_file) = ([tor_cmd], None)
    if args:
        runtime_args += args
    if torrc_path:
        if (torrc_path == NO_TORRC):
            temp_file = tempfile.mkstemp(prefix='empty-torrc-', text=True)[1]
            runtime_args += ['-f', temp_file]
        else:
            runtime_args += ['-f', torrc_path]
    if take_ownership:
        runtime_args += ['__OwningControllerProcess', str(os.getpid())]
    tor_process = subprocess.Popen(runtime_args, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
    if stdin:
        tor_process.stdin.write(stem.util.str_tools._to_bytes(stdin))
        tor_process.stdin.close()
    if timeout:
        def timeout_handler(signum, frame):
            tor_process.kill()
            raise OSError(('reached    a    %i    second    timeout    without    success' % timeout))
        signal.signal(signal.SIGALRM, timeout_handler)
        signal.alarm(timeout)
    bootstrap_line = re.compile('Bootstrapped    ([0-9]+)%:    ')
    problem_line = re.compile('\\[(warn|err)\\]    (.*)$')
    last_problem = 'Timed    out'
    try:
        while True:
            init_line = tor_process.stdout.readline().decode('utf-8', 'replace').strip()
            if (not init_line):
                tor_process.kill()
                raise OSError(('Process    terminated:    %s'...

What's a good function header?

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

def launch_tor(tor_cmd='tor', args=None, torrc_path=None, completion_percent=100, init_msg_handler=None, timeout=DEFAULT_INIT_TIMEOUT, take_ownership=False, stdin=None):