class_docstr: Serializes a stream of objects in batches by calling its wrapped
  Serializer with streams of objects.
class_docstr_tok: ["Serializes","a","stream","of","objects","in","batches","by","calling","its","wrapped","Serializer","with","streams","of","objects","."]
code: def _batched(self, iterable):
      if self.batch_size == self.UNLIMITED_BATCH_SIZE:
          yield list(iterable)
      elif hasattr(iterable, "__len__") and hasattr(
          iterable, "__getslice__"
      ):
          n = len(iterable)
          for i in range(0, n, self.batch_size):
              yield iterable[i : i + self.batch_size]
      else:
          items = []
          count = 0
          for item in iterable:
              items.append(item)
              count += 1
              if count == self.batch_size:
                  yield items
                  items = []
                  count = 0
          if items:
              yield items
  
imports: import pickle
  import struct
  from abc import abstractmethod
  from io import BytesIO
  from itertools import chain
  from typing import TypeVar, Iterable
  from pyflink.common.serializer import TypeSerializer
label_desc: Use image node_id 3 for calling the BatchedSerializer obj's underlying member method code with example usage: obj._batched(iterable) without return types