code: def cov_to_corr(covariance):
      """Return correlation matrix for a given covariance matrix.
  
      Parameters
      ----------
      covariance : 2D numpy.ndarray
          The input covariance matrix.
  
      Returns
      -------
      correlation : 2D numpy.ndarray
          The output correlation matrix.
  
      """
      diagonal = np.atleast_2d(1.0 / np.sqrt(np.diag(covariance)))
      correlation = covariance * diagonal * diagonal.T
  
      # Force exact 1. on diagonal
      np.fill_diagonal(correlation, 1.0)
      return correlation
  
imports: import warnings
  from math import floor, sqrt
  import numpy
  from scipy import linalg
  from sklearn.base import BaseEstimator, TransformerMixin, clone
  from sklearn.covariance import LedoitWolf
  from nilearn._utils.docs import fill_doc
  from ..None import signal
  from .._utils.extmath import is_spd
label_desc: Use image node_id 8 for calling a global function with example usage: cov_to_corr(covariance) and returns: correlation