code: def batched(iterable, n):
      """Batch data into tuples of length n. The last batch may be shorter."""
      # batched('ABCDEFG', 3) --> ABC DEF G
      if n < 1:
          raise ValueError("n must be at least one")
      it = iter(iterable)
      while True:
          batch = tuple(islice(it, n))
          if not batch:
              return
          yield batch
  
file_path: deepchecks/deepchecks/nlp/utils/text_embeddings.py
imports: import re
  import sys
  import warnings
  from itertools import islice
  from typing import Optional
  import numpy
  from tqdm import tqdm
label_desc: Use image node_id 1 for calling a global function with example usage: batched(iterable, n) without return types