human
I wrote the below code

    if (key is None):
        key_callback = _natural_keys
    else:
        def key_callback(item):
            return _natural_keys(key(item))
    return sorted(to_sort, key=key_callback)

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

def nsorted(to_sort, key=None):