parameters: (environment, value, attribute)
return_statement: return [
          _GroupTuple(key, list(values))
          for key, values in groupby(sorted(value, key=expr), expr)
      ]
docstring: Group a sequence of objects by an attribute using Python's
      :func:`itertools.groupby`. The attribute can use dot notation for
      nested access, like ``"address.city"``. Unlike Python's ``groupby``,
      the values are sorted first so only one group is returned for each
      unique value.
  
      For example, a list of ``User`` objects with a ``city`` attribute
      can be rendered in groups. In this example, ``grouper`` refers to
      the ``city`` value of the group.
  
      .. sourcecode:: html+jinja
  
          <ul>{% for city, items in users|groupby("city") %}
            <li>{{ city }}
              <ul>{% for user in items %}
                <li>{{ user.name }}
              {% endfor %}</ul>
            </li>
          {% endfor %}</ul>
  
      ``groupby`` yields namedtuples of ``(grouper, list)``, which
      can be used instead of the tuple unpacking above. ``grouper`` is the
      value of the attribute, and ``list`` is the items with that value.
  
      .. sourcecode:: html+jinja
  
          <ul>{% for group in users|groupby("city") %}
            <li>{{ group.grouper }}: {{ group.list|join(", ") }}
          {% endfor %}</ul>
  
      .. versionchanged:: 2.6
          The attribute supports dot notation for nested access.
docstring_summary: Group a sequence of objects by an attribute using Python's
      :func:`itertools.groupby`. The attribute can use dot notation for
      nested access, like ``"address.city"``. Unlike Python's ``groupby``,
      the values are sorted first so only one group is returned for each
      unique value.
docstring_tokens: Group a sequence of objects by an attribute using Python s : func : itertools . groupby . The attribute can use dot notation for nested access like address . city . Unlike Python s groupby the values are sorted first so only one group is returned for each unique value .
function: def do_groupby(environment, value, attribute):
      """Group a sequence of objects by an attribute using Python's
      :func:`itertools.groupby`. The attribute can use dot notation for
      nested access, like ``"address.city"``. Unlike Python's ``groupby``,
      the values are sorted first so only one group is returned for each
      unique value.
  
      For example, a list of ``User`` objects with a ``city`` attribute
      can be rendered in groups. In this example, ``grouper`` refers to
      the ``city`` value of the group.
  
      .. sourcecode:: html+jinja
  
          <ul>{% for city, items in users|groupby("city") %}
            <li>{{ city }}
              <ul>{% for user in items %}
                <li>{{ user.name }}
              {% endfor %}</ul>
            </li>
          {% endfor %}</ul>
  
      ``groupby`` yields namedtuples of ``(grouper, list)``, which
      can be used instead of the tuple unpacking above. ``grouper`` is the
      value of the attribute, and ``list`` is the items with that value.
  
      .. sourcecode:: html+jinja
  
          <ul>{% for group in users|groupby("city") %}
            <li>{{ group.grouper }}: {{ group.list|join(", ") }}
          {% endfor %}</ul>
  
      .. versionchanged:: 2.6
          The attribute supports dot notation for nested access.
      """
      expr = make_attrgetter(environment, attribute)
      return [
          _GroupTuple(key, list(values))
          for key, values in groupby(sorted(value, key=expr), expr)
      ]
function_tokens: def do_groupby ( environment , value , attribute ) : expr = make_attrgetter ( environment , attribute ) return [ _GroupTuple ( key , list ( values ) ) for key , values in groupby ( sorted ( value , key = expr ) , expr ) ]