code: def _class_cov(
      X, y, priors, shrinkage=None, covariance_estimator=None
  ):
      """Compute weighted within-class covariance matrix.
  
      The per-class covariance are weighted by the class priors.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          Input data.
  
      y : array-like of shape (n_samples,) or (n_samples, n_targets)
          Target values.
  
      priors : array-like of shape (n_classes,)
          Class priors.
  
      shrinkage : 'auto' or float, default=None
          Shrinkage parameter, possible values:
            - None: no shrinkage (default).
            - 'auto': automatic shrinkage using the Ledoit-Wolf lemma.
            - float between 0 and 1: fixed shrinkage parameter.
  
          Shrinkage parameter is ignored if `covariance_estimator` is not None.
  
      covariance_estimator : estimator, default=None
          If not None, `covariance_estimator` is used to estimate
          the covariance matrices instead of relying the empirical
          covariance estimator (with potential shrinkage).
          The object should have a fit method and a ``covariance_`` attribute
          like the estimators in sklearn.covariance.
          If None, the shrinkage parameter drives the estimate.
  
          .. versionadded:: 0.24
  
      Returns
      -------
      cov : array-like of shape (n_features, n_features)
          Weighted within-class covariance matrix
      """
      classes = np.unique(y)
      cov = np.zeros(shape=(X.shape[1], X.shape[1]))
      for idx, group in enumerate(classes):
          Xg = X[y == group, :]
          cov += priors[idx] * np.atleast_2d(
              _cov(Xg, shrinkage, covariance_estimator)
          )
      return cov
  
imports: import warnings
  from numbers import Integral, Real
  import numpy
  import scipy.linalg
  from scipy import linalg
  from .base import BaseEstimator, ClassifierMixin, ClassNamePrefixFeaturesOutMixin, TransformerMixin, _fit_context
  from .covariance import empirical_covariance, ledoit_wolf, shrunk_covariance
  from .linear_model._base import LinearClassifierMixin
  from .preprocessing import StandardScaler
  from .utils._array_api import _expit, device, get_namespace, size
  from .utils._param_validation import HasMethods, Interval, StrOptions
  from .utils.extmath import softmax
  from .utils.multiclass import check_classification_targets, unique_labels
  from .utils.validation import check_is_fitted
label_desc: Use image node_id 3 for calling a global function with example usage: _class_cov(X, y, priors, shrinkage, covariance_estimator) and returns: cov