code: def _estimate_gaussian_covariances_tied(
      resp, X, nk, means, reg_covar
  ):
      """Estimate the tied covariance matrix.
  
      Parameters
      ----------
      resp : array-like of shape (n_samples, n_components)
  
      X : array-like of shape (n_samples, n_features)
  
      nk : array-like of shape (n_components,)
  
      means : array-like of shape (n_components, n_features)
  
      reg_covar : float
  
      Returns
      -------
      covariance : array, shape (n_features, n_features)
          The tied covariance matrix of the components.
      """
      avg_X2 = np.dot(X.T, X)
      avg_means2 = np.dot(nk * means.T, means)
      covariance = avg_X2 - avg_means2
      covariance /= nk.sum()
      covariance.flat[:: len(covariance) + 1] += reg_covar
      return covariance
  
imports: import numpy
  from scipy import linalg
  from ..utils import check_array
  from ..utils._param_validation import StrOptions
  from ..utils.extmath import row_norms
  from ._base import BaseMixture, _check_shape
label_desc: Use image node_id 8 for calling a global function with example usage: _estimate_gaussian_covariances_tied(resp, X, nk, means, reg_covar) and returns: covariance