title: itertools.groupby: iterate over groups pairwise
body: <p>How can I iterate over <code>groupby</code> results in pairs? What I tried isn't quite working:</p>
  
  <pre><code>from itertools import groupby,izip
  
  groups = groupby([(1,2,3),(1,2),(1,2),(3,4,5),(3,4)],key=len)
  
  def grouped(iterable, n):    
      return izip(*[iterable]*n)
  
  for g, gg in grouped(groups,2):
      print list(g[1]), list(gg[1])
  </code></pre>
  
  <p>Output I get:</p>
  
  <pre><code>[] [(1, 2), (1, 2)]
  [] [(3, 4)]
  </code></pre>
  
  <p>Output I would like to have:</p>
  
  <pre><code>[(1, 2, 3)] [(1, 2), (1, 2)]
  [(3, 4, 5)] [(3, 4)]
  </code></pre>