code: def batch_inputs(
      input_records: Sequence[Mapping[K, V]],
      keys: Optional[Collection[K]] = None,
  ) -> dict[K, list[V]]:
      """Batch inputs from list-of-dicts to dict-of-lists."""
      assert input_records, "Must have non-empty batch!"
      if keys is None:
          keys = input_records[0].keys()
  
      ret = {}
      for k in keys:
          ret[k] = [r[k] for r in input_records]
      return ret
  
imports: from collections.abc import Callable, Collection, Iterable, Iterator, Mapping, Sequence
  import itertools
  import queue
  import threading
  import time
  from typing import Any, Optional, TypeVar, Union
  import uuid
  from lit_nlp.api import types
  import numpy
label_desc: Use image node_id 11 for calling a global function with example usage: batch_inputs(input_records, keys) and returns: ret