nodes: 0, module; 1, function_definition; 2, function_name:do_sort; 3, parameters; 4, block; 5, identifier:environment; 6, identifier:value; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:reverse; 14, False; 15, identifier:case_sensitive; 16, False; 17, identifier:attribute; 18, None; 19, comment:"""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.
      """; 20, assignment; 21, call; 22, identifier:key_func; 23, call; 24, identifier:sorted; 25, argument_list; 26, identifier:make_attrgetter; 27, argument_list; 28, identifier:value; 29, keyword_argument; 30, keyword_argument; 31, identifier:environment; 32, identifier:attribute; 33, keyword_argument; 34, identifier:key; 35, identifier:key_func; 36, identifier:reverse; 37, identifier:reverse; 38, identifier:postprocess; 39, conditional_expression:ignore_case if not case_sensitive else None; 40, identifier:ignore_case; 41, not_operator; 42, None; 43, identifier:case_sensitive
code: 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.
      """
      key_func = make_attrgetter(
          environment, attribute,
          postprocess=ignore_case if not case_sensitive else None
      )
      return sorted(value, key=key_func, reverse=reverse)