parameters: (iterable, keyfunc=None, valuefunc=None)
return_statement: return ((k, map(valuefunc, g)) for k, g in groupby(iterable, keyfunc))
docstring: An extension of :func:`itertools.groupby` that transforms the values of
      *iterable* after grouping them.
      *keyfunc* is a function used to compute a grouping key for each item.
      *valuefunc* is a function for transforming the items after grouping.
  
          >>> iterable = 'AaaABbBCcA'
          >>> keyfunc = lambda x: x.upper()
          >>> valuefunc = lambda x: x.lower()
          >>> grouper = groupby_transform(iterable, keyfunc, valuefunc)
          >>> [(k, ''.join(g)) for k, g in grouper]
          [('A', 'aaaa'), ('B', 'bbb'), ('C', 'cc'), ('A', 'a')]
  
      *keyfunc* and *valuefunc* default to identity functions if they are not
      specified.
  
      :func:`groupby_transform` is useful when grouping elements of an iterable
      using a separate iterable as the key. To do this, :func:`zip` the iterables
      and pass a *keyfunc* that extracts the first element and a *valuefunc*
      that extracts the second element::
  
          >>> from operator import itemgetter
          >>> keys = [0, 0, 1, 1, 1, 2, 2, 2, 3]
          >>> values = 'abcdefghi'
          >>> iterable = zip(keys, values)
          >>> grouper = groupby_transform(iterable, itemgetter(0), itemgetter(1))
          >>> [(k, ''.join(g)) for k, g in grouper]
          [(0, 'ab'), (1, 'cde'), (2, 'fgh'), (3, 'i')]
  
      Note that the order of items in the iterable is significant.
      Only adjacent items are grouped together, so if you don't want any
      duplicate groups, you should sort the iterable by the key function.
docstring_summary: An extension of :func:`itertools.groupby` that transforms the values of
      *iterable* after grouping them.
      *keyfunc* is a function used to compute a grouping key for each item.
      *valuefunc* is a function for transforming the items after grouping.
docstring_tokens: An extension of : func : itertools . groupby that transforms the values of * iterable * after grouping them . * keyfunc * is a function used to compute a grouping key for each item . * valuefunc * is a function for transforming the items after grouping .
function: def groupby_transform(iterable, keyfunc=None, valuefunc=None):
      """An extension of :func:`itertools.groupby` that transforms the values of
      *iterable* after grouping them.
      *keyfunc* is a function used to compute a grouping key for each item.
      *valuefunc* is a function for transforming the items after grouping.
  
          >>> iterable = 'AaaABbBCcA'
          >>> keyfunc = lambda x: x.upper()
          >>> valuefunc = lambda x: x.lower()
          >>> grouper = groupby_transform(iterable, keyfunc, valuefunc)
          >>> [(k, ''.join(g)) for k, g in grouper]
          [('A', 'aaaa'), ('B', 'bbb'), ('C', 'cc'), ('A', 'a')]
  
      *keyfunc* and *valuefunc* default to identity functions if they are not
      specified.
  
      :func:`groupby_transform` is useful when grouping elements of an iterable
      using a separate iterable as the key. To do this, :func:`zip` the iterables
      and pass a *keyfunc* that extracts the first element and a *valuefunc*
      that extracts the second element::
  
          >>> from operator import itemgetter
          >>> keys = [0, 0, 1, 1, 1, 2, 2, 2, 3]
          >>> values = 'abcdefghi'
          >>> iterable = zip(keys, values)
          >>> grouper = groupby_transform(iterable, itemgetter(0), itemgetter(1))
          >>> [(k, ''.join(g)) for k, g in grouper]
          [(0, 'ab'), (1, 'cde'), (2, 'fgh'), (3, 'i')]
  
      Note that the order of items in the iterable is significant.
      Only adjacent items are grouped together, so if you don't want any
      duplicate groups, you should sort the iterable by the key function.
  
      """
      valuefunc = (lambda x: x) if valuefunc is None else valuefunc
      return ((k, map(valuefunc, g)) for k, g in groupby(iterable, keyfunc))
function_tokens: def groupby_transform ( iterable , keyfunc = None , valuefunc = None ) : valuefunc = ( lambda x : x ) if valuefunc is None else valuefunc return ( ( k , map ( valuefunc , g ) ) for k , g in groupby ( iterable , keyfunc ) )