code: def batched_iterator(records, batch_size):
      """Groups elements in the given list into batches of the given size.
  
      Args:
        records: List of elements to batch.
        batch_size: Size of each batch.
  
      Yields:
        Lists with batch_size elements from records. Every list yielded except the
        last will contain exactly batch_size elements.
      """
      batch = []
      for i, x in enumerate(records):
          batch.append(x)
          if (i + 1) % batch_size == 0:
              yield batch
              batch = []
      if batch:
          yield batch
  
imports: import importlib
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: batched_iterator(records, batch_size) without return types