human
I wrote the below code

    logger = logging.getLogger('luigi-interface')
    with luigi.cmdline_parser.CmdlineParser.global_instance(argv):
        retcodes = retcode()
    worker = None
    try:
        worker = luigi.interface._run(argv)['worker']
    except luigi.interface.PidLockAlreadyTakenExit:
        sys.exit(retcodes.already_running)
    except Exception:
        luigi.interface.setup_interface_logging()
        logger.exception('Uncaught    exception    in    luigi')
        sys.exit(retcodes.unhandled_exception)
    task_sets = luigi.execution_summary._summary_dict(worker)
    root_task = luigi.execution_summary._root_task(worker)
    non_empty_categories = {k: v for (k, v) in task_sets.items() if v}.keys()
    def has(status):
        assert (status in luigi.execution_summary._ORDERED_STATUSES)
        return (status in non_empty_categories)
    codes_and_conds = ((retcodes.missing_data, has('still_pending_ext')), (retcodes.task_failed, has('failed')), (retcodes.already_running, has('run_by_other_worker')), (retcodes.scheduling_error, has('scheduling_error')), (retcodes.not_run, has('not_run')))
    expected_ret_code = max(((code * (1 if cond else 0)) for (code, cond) in codes_and_conds))
    if ((expected_ret_code == 0) and (root_task not in task_sets['completed']) and (root_task not in task_sets['already_done'])):
        sys.exit(retcodes.not_run)
    else:
        sys.exit(expected_ret_code)

What's a good function header?

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

def run_with_retcodes(argv):