def nsorted(to_sort, key=None):
    """Returns a naturally sorted list"""
    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)
def nsorted ( to_sort , key = None ) : 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 )
Returns a naturally sorted list