human
Complete this python program:
def do_sort(value, case_sensitive=False):
assistant
#Here is the Python program you requested.

    """Sort an iterable.  If the iterable is made of strings the second
    parameter can be used to control the case sensitiveness of the
    comparison which is disabled by default.
    .. sourcecode:: jinja
    {% for item in iterable|sort %}
    {% endfor %}
    """
    if (not case_sensitive):
        def sort_func(item):
            if isinstance(item, basestring):
                item = item.lower()
            return item
    else:
        sort_func = None
    return sorted(seq, key=sort_func)