code: def mean_kullback_sym(X=None, sample_weight=None, covmats=None):
      """Mean of SPD/HPD matrices according to Kullback-Leibler divergence.
  
      Symmetrized Kullback-Leibler mean is the geometric mean between the
      Euclidean and the harmonic means [1]_.
  
      Parameters
      ----------
      X : ndarray, shape (n_matrices, n, n)
          Set of SPD/HPD matrices.
      sample_weight : None | ndarray, shape (n_matrices,), default=None
          Weights for each matrix. If None, it uses equal weights.
  
      Returns
      -------
      M : ndarray, shape (n, n)
          Symmetrized Kullback-Leibler mean.
  
      See Also
      --------
      mean_covariance
  
      References
      ----------
      .. [1] `Symmetric positive-definite matrices: From geometry to applications
          and visualization
          <https://link.springer.com/chapter/10.1007/3-540-31272-2_17>`_
          M. Moakher and P. Batchelor. Visualization and Processing of Tensor
          Fields, pp. 285-298, 2006
      """
      X = _deprecate_covmats(covmats, X)
      M_euclid = mean_euclid(X, sample_weight=sample_weight)
      M_harmonic = mean_harmonic(X, sample_weight=sample_weight)
      M = geodesic_riemann(M_euclid, M_harmonic, 0.5)
      return M
  
imports: from copy import deepcopy
  import numpy
  import warnings
  from .ajd import ajd_pham
  from .base import sqrtm, invsqrtm, logm, expm, powm
  from .distance import distance_riemann
  from .geodesic import geodesic_riemann
  from .utils import check_weights
label_desc: Use image node_id 7 for calling a global function with example usage: mean_kullback_sym(X, sample_weight, covmats) and returns: M