code: def _extract_batch_length(preds):
      """Extracts batch length of predictions."""
      batch_length = None
      for key, value in preds.items():
          this_length = (
              len(value)
              if isinstance(value, (list, tuple))
              else value.shape[0]
          )
          batch_length = batch_length or this_length
          if this_length != batch_length:
              raise ValueError(
                  "Batch length of predictions should be same. %s has "
                  "different batch length than others." % key
              )
      return batch_length
  
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 12 for calling a global function with example usage: _extract_batch_length(preds) and returns: batch_length