human
I wrote the below code

    name = os.path.expanduser(name)
    ret = {'name': name, 'changes': {'retained': [], 'deleted': [], 'ignored': []}, 'pchanges': {'retained': [], 'deleted': [], 'ignored': []}, 'result': True, 'comment': ''}
    if (not name):
        return _error(ret, 'Must    provide    name    to    file.retention_schedule')
    if (not os.path.isdir(name)):
        return _error(ret, 'Name    provided    to    file.retention    must    be    a    directory')
    all_files = __salt__['file.readdir'](name)
    beginning_of_unix_time = datetime(1970, 1, 1)
    def get_file_time_from_strptime(f):
        try:
            ts = datetime.strptime(f, strptime_format)
            ts_epoch = salt.utils.total_seconds((ts - beginning_of_unix_time))
            return (ts, ts_epoch)
        except ValueError:
            return (None, None)
    def get_file_time_from_mtime(f):
        lstat = __salt__['file.lstat'](os.path.join(name, f))
        if lstat:
            mtime = lstat['st_mtime']
            return (datetime.fromtimestamp(mtime, timezone), mtime)
        else:
            return (None, None)
    get_file_time = (get_file_time_from_strptime if strptime_format else get_file_time_from_mtime)
    def dict_maker():
        return defaultdict(dict_maker)
    files_by_ymd = dict_maker()
    files_by_y_week_dow = dict_maker()
    relevant_files = set()
    ignored_files = set()
    for f in all_files:
        (ts, ts_epoch) = get_file_time(f)
        if ts:
            files_by_ymd[ts.year][ts.month][ts.day][ts.hour][ts_epoch] = f
            week_of_year = ts.isocalendar()[1]
            files_by_y_week_dow[ts.year][week_of_year][ts.weekday()][ts_epoch] = f
            relevant_files.add(f)
        else:
            ignored_files.add(f)
    RETAIN_TO_DEPTH = {'first_of_year': 1, 'first_of_month': 2, 'first_of_day': 3, 'first_of_hour': 4, 'most_recent': 5}
    def get_first(fwt):
        if isinstance(fwt, dict):
            first_sub_key = sorted(fwt.keys())[0]
            return get_first(fwt[first_sub_key])
        else:
 ...

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

def retention_schedule(name, retain, strptime_format=None, timezone=None):