code: def configure_minibatch(
      size: Sizing, get_length: Optional[Callable[[ItemT], int]] = None
  ) -> BatcherT:
      """Create a batcher that creates batches of the specified size.
  
      size (int or Sequence[int]): The target number of items per batch.
          Can be a single integer, or a sequence, allowing for variable batch sizes.
      """
      optionals = (
          {"get_length": get_length} if get_length is not None else {}
      )
      return partial(minibatch, size=size, **optionals)
  
file_path: spacy/spacy/training/batchers.py
imports: import itertools
  from functools import partial
  from typing import Any, Callable, Iterable, Iterator, List, Optional, Sequence, TypeVar, Union
  from ..util import minibatch, registry
label_desc: Use image node_id 3 for calling a global function with example usage: configure_minibatch(size, get_length) and returns: partial