human
I wrote the below code

    if (not case_sensitive):
        def sort_func(item):
            if isinstance(item, string_types):
                item = item.lower()
            return item
    else:
        sort_func = None
    if (attribute is not None):
        getter = make_attrgetter(environment, attribute)
        def sort_func(item, processor=(sort_func or (lambda x: x))):
            return processor(getter(item))
    return sorted(value, key=sort_func, reverse=reverse)

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

@environmentfilter
def do_sort(environment, value, reverse=False, case_sensitive=False, attribute=None):