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(itertools.islice(it, n))
          if not batch:
              break
          yield batch
  
imports: from __future__ import absolute_import
  from pathlib import Path
  from typing import List
  import argparse
  import email.parser
  import email.policy
  import json
  import inspect
  import itertools
  import subprocess
  import sys
  import tqdm
  import cloudpickle
  import boto3
label_desc: Use image node_id 3 for calling a global function with example usage: batched(iterable, n) without return types