human
I wrote the below code

    python_shell = _python_shell_default(python_shell, kwargs.get('__pub_jid', ''))
    def _cleanup_tempfile(path):
        try:
            __salt__['file.remove'](path)
        except (SaltInvocationError, CommandExecutionError) as exc:
            log.error("cmd.script:    Unable    to    clean    tempfile    '{0}':    {1}".format(path, exc))
    if ('__env__' in kwargs):
        salt.utils.warn_until('Oxygen', "Parameter    '__env__'    has    been    detected    in    the    argument    list.        This    parameter    is    no    longer    used    and    has    been    replaced    by    'saltenv'    as    of    Salt    2016.11.0.        This    warning    will    be    removed    in    Salt    Oxygen.")
        kwargs.pop('__env__')
    if (salt.utils.platform.is_windows() and runas and (cwd is None)):
        cwd = tempfile.mkdtemp(dir=__opts__['cachedir'])
        __salt__['win_dacl.add_ace'](cwd, 'File', runas, 'READ&EXECUTE', 'ALLOW', 'FOLDER&SUBFOLDERS&FILES')
    path = salt.utils.files.mkstemp(dir=cwd, suffix=os.path.splitext(source)[1])
    if template:
        if (('pillarenv' in kwargs) or ('pillar' in kwargs)):
            pillarenv = kwargs.get('pillarenv', __opts__.get('pillarenv'))
            kwargs['pillar'] = _gather_pillar(pillarenv, kwargs.get('pillar'))
        fn_ = __salt__['cp.get_template'](source, path, template, saltenv, **kwargs)
        if (not fn_):
            if (salt.utils.platform.is_windows() and runas):
                _cleanup_tempfile(cwd)
            else:
                _cleanup_tempfile(path)
            return {'pid': 0, 'retcode': 1, 'stdout': '', 'stderr': '', 'cache_error': True}
    else:
        fn_ = __salt__['cp.cache_file'](source, saltenv)
        if (not fn_):
            if (salt.utils.platform.is_windows() and runas):
                _cleanup_tempfile(cwd)
            else:
                _cleanup_tempfile(path)
            return {'pid': 0, 'retcode': 1, 'stdout': '', 'stderr': '', 'cache_error': True}
        shutil.copyfile(fn_, path)
    if...

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

def script(source, args=None, cwd=None, stdin=None, runas=None, shell=DEFAULT_SHELL, python_shell=None, env=None, template=None, umask=None, output_loglevel='debug', log_callback=None, quiet=False, timeout=None, reset_system_locale=True, saltenv='base', use_vt=False, bg=False, password=None, **kwargs):