code: def distance_kullback_sym(A, B, squared=False):
      r"""Symmetrized Kullback-Leibler divergence between SPD/HPD matrices.
  
      The symmetrized Kullback-Leibler divergence between two SPD/HPD matrices
      :math:`\mathbf{A}` and :math:`\mathbf{B}` is the sum of left and right
      Kullback-Leibler divergences.
      It is also called Jeffreys divergence [1]_.
  
      Parameters
      ----------
      A : ndarray, shape (..., n, n)
          First SPD/HPD matrices, at least 2D ndarray.
      B : ndarray, shape (..., n, n)
          Second SPD/HPD matrices, same dimensions as A.
      squared : bool, default False
          Return squared distance.
  
          .. versionadded:: 0.5
  
      Returns
      -------
      d : float or ndarray, shape (...,)
          Symmetrized Kullback-Leibler divergence between A and B.
  
      See Also
      --------
      distance
  
      References
      ----------
      .. [1] `An invariant form for the prior probability in estimation problems
          <https://www.jstor.org/stable/97883>`_
          H. Jeffreys.
          Proceedings of the Royal Society of London A: mathematical, physical
          and engineering sciences, 1946, 186 (1007), pp. 453-461
      """
      d = distance_kullback(A, B) + distance_kullback_right(A, B)
      return d**2 if squared else d
  
imports: import numpy
  from scipy.linalg import eigvalsh, solve
  from sklearn.metrics import euclidean_distances
  from .base import logm, sqrtm, invsqrtm
label_desc: Use image node_id 7 for calling a global function with example usage: distance_kullback_sym(A, B, squared) and returns: unknown