def _gen_unzip(it, elem_len):
 elem = next(it)
 first_elem_len = len(elem)
 if ((elem_len is not None) and (elem_len != first_elem_len)):
  raise ValueError(('element at index 0 was length %d, expected %d' % (first_elem_len, elem_len)))
 else:
  elem_len = first_elem_len
 (yield elem)
 for (n, elem) in enumerate(it, 1):
  if (len(elem) != elem_len):
   raise ValueError(('element at index %d was length %d, expected %d' % (n, len(elem), elem_len)))
  (yield elem)

def _gen_unzip ( it , elem_len ) : elem = next ( it ) first_elem_len = len ( elem ) if ( ( elem_len is not None ) and ( elem_len != first_elem_len ) ) : raise ValueError ( ( 'element at index 0 was length %d, expected %d' % ( first_elem_len , elem_len ) ) ) else : elem_len = first_elem_len ( yield elem ) for ( n , elem ) in enumerate ( it , 1 ) : if ( len ( elem ) != elem_len ) : raise ValueError ( ( 'element at index %d was length %d, expected %d' % ( n , len ( elem ) , elem_len ) ) ) ( yield elem )
helper for unzip which checks the lengths of each element in it .