code: def int2onehot(labels: list, K: int) -> np.ndarray:
      """Convert multi-label classification `labels` from a ``List[List[int]]`` format to a onehot matrix.
      This returns a binarized format of the labels as a multi-hot vector for each example, where the entries in this vector are 1 for each class that applies to this example and 0 otherwise.
  
      Parameters
      ----------
      labels: list of lists of integers
        e.g. [[0,1], [3], [1,2,3], [1], [2]]
        All integers from 0,1,...,K-1 must be represented.
      K: int
        The number of classes."""
  
      from sklearn.preprocessing import MultiLabelBinarizer
  
      mlb = MultiLabelBinarizer(classes=range(K))
      return mlb.fit_transform(labels)
  
file_path: cleanlab/cleanlab/internal/multilabel_utils.py
imports: from typing import Tuple, Optional, List
  import numpy
  from cleanlab.internal.util import get_num_classes
label_desc: Use image node_id 4 for calling a global function with example usage: int2onehot(labels, K) and returns: mlb