human
I wrote the below code

    if (by == 'key'):
        pos = 0
    elif (by == 'value'):
        pos = 1
    else:
        raise FilterArgumentError('You    can    only    sort    by    either    "key"    or    "value"')
    def sort_func(item):
        value = item[pos]
        if (not case_sensitive):
            value = ignore_case(value)
        return value
    return sorted(value.items(), key=sort_func, reverse=reverse)

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

def do_dictsort(value, case_sensitive=False, by='key', reverse=False):