def unflatten(iter, n=2):
 if ((n < 1) or (len(iter) % n)):
  raise ValueError(('iter length is not a multiple of %i' % n))
 return list(zip(*(iter[i::n] for i in range(n))))

def unflatten ( iter , n = 2 ) : if ( ( n < 1 ) or ( len ( iter ) % n ) ) : raise ValueError ( ( 'iter length is not a multiple of %i' % n ) ) return list ( zip ( * ( iter [ i : : n ] for i in range ( n ) ) ) )
group iter into tuples of length n .