code: def _csd_from_mt(x_mt, y_mt, weights_x, weights_y):
      """Compute CSD from tapered spectra.
  
      Parameters
      ----------
      x_mt : array, shape=(..., n_tapers, n_freqs)
          Tapered spectra for x
      y_mt : array, shape=(..., n_tapers, n_freqs)
          Tapered spectra for y
      weights_x : array, shape=(n_tapers,)
          Weights used to combine the tapered spectra of x_mt
      weights_y : array, shape=(n_tapers,)
          Weights used to combine the tapered spectra of y_mt
  
      Returns
      -------
      csd: array
          The computed CSD
      """
      csd = np.sum(
          weights_x * x_mt * (weights_y * y_mt).conj(), axis=-2
      )
      denom = np.sqrt(
          (weights_x * weights_x.conj()).real.sum(axis=-2)
      ) * np.sqrt((weights_y * weights_y.conj()).real.sum(axis=-2))
      csd *= 2 / denom
      return csd
  
file_path: mne-python/mne/time_frequency/multitaper.py
imports: import numpy
  from scipy.fft import rfft, rfftfreq
  from scipy.integrate import trapezoid
  from scipy.signal import get_window
  from scipy.signal.windows import dpss
  from ..parallel import parallel_func
  from ..utils import _check_option, logger, verbose, warn
label_desc: Use image node_id 4 for calling a global function with example usage: _csd_from_mt(x_mt, y_mt, weights_x, weights_y) and returns: csd