code: def do_sort(
      environment, value, reverse=False, case_sensitive=False, attribute=None
  ):
      
      key_func = make_attrgetter(
          environment, attribute,
          postprocess=ignore_case if not case_sensitive else None
      )
      return sorted(value, key=key_func, reverse=reverse)
docs: 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.