code: def assert_all_elements_same_length(
      elements: Iterable,
      error_msg: str = "not all elements have the same length",
  ) -> int:
      """
      Asserts that all elements in the iterable have the same length.
  
      Can be useful when you have a list of lists representing rows or columns, for
      example. Returns the length.
      """
      unique_lengths = set(len(l) for l in elements)
      assert len(unique_lengths) == 1, f"{error_msg} | {unique_lengths}"
      return list(unique_lengths)[0]
  
file_path: ParlAI/projects/roscoe/utils.py
imports: import numpy
  import os
  import pathlib
  from nltk.tokenize import sent_tokenize
  from typing import Callable, Dict, Iterable, List, Tuple
  import torch
label_desc: Use image node_id 7 for calling a global function with example usage: assert_all_elements_same_length(elements, error_msg) and returns: list