class_docstr: Batcher designed to batch rows of data, before padding.
code: def _group_iter(
      self, iterable: Iterable[RawExample], group_size, sort_key=None
  ):
      iterators = [iter(iterable)] * group_size
      for group in itertools.zip_longest(*iterators):
          group = [ex for ex in group if ex is not None]
          if sort_key:
              group.sort(key=sort_key, reverse=True)
          yield group
  
imports: import functools
  import itertools
  import math
  import random
  from typing import Any, Dict, Iterable, List, MutableMapping, NamedTuple, Optional, Type
  from pytext.common.constants import RawExampleFieldName, Stage
  from pytext.config.component import Component, ComponentType, create_component, Registry
  from pytext.utils.usage import log_class_usage
  from .sources import DataSource, RawExample, TSVDataSource
  from .sources.data_source import GeneratorIterator, RowShardedDataSource, ShardedDataSource
  from .tensorizers import initialize_tensorizers, MetricTensorizer, Tensorizer
label_desc: Use image node_id 4 for calling the Batcher obj's underlying member method code with example usage: obj._group_iter(iterable, group_size, sort_key) without return types