parameters: (*iterables, **kwargs)
docstring: Helper for ``collate()``, called when the user is using the ``reverse``
      or ``key`` keyword arguments on Python versions below 3.5.
docstring_summary: Helper for ``collate()``, called when the user is using the ``reverse``
      or ``key`` keyword arguments on Python versions below 3.5.
docstring_tokens: Helper for collate () called when the user is using the reverse or key keyword arguments on Python versions below 3 . 5 .
function: def _collate(*iterables, **kwargs):
      """Helper for ``collate()``, called when the user is using the ``reverse``
      or ``key`` keyword arguments on Python versions below 3.5.
  
      """
      key = kwargs.pop('key', lambda a: a)
      reverse = kwargs.pop('reverse', False)
  
      min_or_max = partial(max if reverse else min, key=itemgetter(0))
      peekables = [peekable(it) for it in iterables]
      peekables = [p for p in peekables if p]  # Kill empties.
      while peekables:
          _, p = min_or_max((key(p.peek()), p) for p in peekables)
          yield next(p)
          peekables = [x for x in peekables if x]
function_tokens: def _collate ( * iterables , * * kwargs ) : key = kwargs . pop ( 'key' , lambda a : a ) reverse = kwargs . pop ( 'reverse' , False ) min_or_max = partial ( max if reverse else min , key = itemgetter ( 0 ) ) peekables = [ peekable ( it ) for it in iterables ] peekables = [ p for p in peekables if p ] # Kill empties. while peekables : _ , p = min_or_max ( ( key ( p . peek ( ) ) , p ) for p in peekables ) yield next ( p ) peekables = [ x for x in peekables if x ]