def flatten_subtoken_lists(
    subtoken_lists):
  """Flattens lists of subtoken lists.

  Args:
    subtoken_lists: A list of subtoken lists, one list per initial language
      token. Cannot be empty or contain empty sublits.

  Returns:
    A list of flattened subtokens representing the entire original sequence.

  Raises:
    ValueError: If the input is empty.
  """
  if not subtoken_lists:
    raise ValueError('Received empty input %r but expected it to be non '
                     'empty' % (subtoken_lists,))
  spellings = (t.spellings for t in subtoken_lists)
  subtokens = sum(spellings, [])

  return subtokens