code: def multilabel_py(y: np.ndarray) -> np.ndarray:
      """Compute the prior probability of each label in a multi-label classification problem.
  
      Parameters
      ----------
      y :
          A 2d array of binarized multi-labels of shape (N, K) where N is the number of samples and K is the number of classes.
  
      Returns
      -------
      py :
          A 2d array of prior probabilities of shape (K,2) where the first column is the probability of the label being 0
          and the second column is the probability of the label being 1 for each class.
  
      Examples
      --------
      >>> from cleanlab.internal.multilabel_scorer import multilabel_py
      >>> import numpy as np
      >>> y = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
      >>> multilabel_py(y)
      array([[0.5, 0.5],
             [0.5, 0.5]])
      >>> y = np.array([[0, 0], [0, 1], [1, 0], [1, 0], [1, 0]])
      >>> multilabel_py(y)
      array([[0.4, 0.6],
             [0.8, 0.2]])
      """
  
      def compute_class_py(y_slice: np.ndarray) -> np.ndarray:
          # Should only consider a single class at a time
          assert y_slice.ndim == 1
          unique_values, counts = np.unique(
              y_slice, axis=0, return_counts=True
          )
          N = y_slice.shape[0]
          if len(unique_values) == 1:
              # Should be 0 and 1, pad with 0 probability if either is missing.
              counts = np.array(
                  [0, N] if unique_values[0] == 1 else [N, 0]
              )
          return counts / N
  
      py = np.apply_along_axis(compute_class_py, axis=1, arr=y.T)
      return py
  
imports: from enum import Enum
  from typing import Callable, Dict, Optional, Union
  import numpy
  from sklearn.model_selection import cross_val_predict
  from cleanlab.internal.multilabel_utils import _is_multilabel, stack_complement
  from cleanlab.internal.label_quality_utils import _subtract_confident_thresholds
  from cleanlab.internal.numerics import softmax
  from cleanlab.rank import get_self_confidence_for_each_label, get_normalized_margin_for_each_label, get_confidence_weighted_entropy_for_each_label
label_desc: Use image node_id 4 for calling a global function with example usage: multilabel_py(y) and returns: py, unknown