code: def require_single_item(fn):
      """
      Will check that the input is a single item.
      Useful when heuristics do not work on multi-output.
  
      Args:
          fn (Fn): Function that takes logits as input to wraps.
  
      Returns:
          Wrapper function
  
      """
  
      @_wraps(fn)
      def wrapper(self, probabilities):
          # Expected single shape : [n_sample, n_classes, ..., n_iterations]
          if isinstance(probabilities, (list, tuple)):
              if len(probabilities) == 1:
                  probabilities = probabilities[0]
              else:
                  raise ValueError(
                      "This heuristic accepts a single array with shape "
                      "[n_sample, n_classes, ..., n_iterations]. If you want"
                      " to compute uncertainty on a multi-model outputs,"
                      " we suggest using baal.active.heuristics.CombineHeuristics"
                  )
  
          return fn(self, probabilities)
  
      return wrapper
  
imports: import types
  import warnings
  from collections.abc import Sequence
  from functools import wraps
  from typing import List
  import numpy
  import scipy.stats
  import torch
  from scipy.special import xlogy
  from torch import Tensor
  from baal.utils.array_utils import to_prob
label_desc: Use image node_id 4 for calling a global function with example usage: require_single_item(fn) and returns: wrapper, fn