def safe_zip(*iterables):
  """Like builtin `zip`, but checks that iterables have same length."""
  n = len(iterables[0])
  for iterable in iterables:
    if len(iterable) != n:
      raise ValueError("Zipped items must all have same length.")
  return zip(*iterables)
Like builtin `zip`, but checks that iterables have same length.
language/conpono/reconstruct/preprocess.py