parameters: (environment, value, reverse=False, case_sensitive=False,
              attribute=None)
return_statement: return sorted(value, key=sort_func, reverse=reverse)
docstring: Sort an iterable.  Per default it sorts ascending, if you pass it
      true as first argument it will reverse the sorting.
  
      If the iterable is made of strings the third 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 %}
  
      It is also possible to sort by an attribute (for example to sort
      by the date of an object) by specifying the `attribute` parameter:
  
      .. sourcecode:: jinja
  
          {% for item in iterable|sort(attribute='date') %}
              ...
          {% endfor %}
  
      .. versionchanged:: 2.6
         The `attribute` parameter was added.
docstring_summary: Sort an iterable.  Per default it sorts ascending, if you pass it
      true as first argument it will reverse the sorting.
docstring_tokens: Sort an iterable . Per default it sorts ascending if you pass it true as first argument it will reverse the sorting .
function: def do_sort(environment, value, reverse=False, case_sensitive=False,
              attribute=None):
      """Sort an iterable.  Per default it sorts ascending, if you pass it
      true as first argument it will reverse the sorting.
  
      If the iterable is made of strings the third 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 %}
  
      It is also possible to sort by an attribute (for example to sort
      by the date of an object) by specifying the `attribute` parameter:
  
      .. sourcecode:: jinja
  
          {% for item in iterable|sort(attribute='date') %}
              ...
          {% endfor %}
  
      .. versionchanged:: 2.6
         The `attribute` parameter was added.
      """
      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)
function_tokens: def do_sort ( environment , value , reverse = False , case_sensitive = False , attribute = None ) : 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 )