code: def sym_distance(cls, q0, q1):
          
          q = Quaternion.sym_log_map(q0, q1)
          return q.norm
docs: Quaternion symmetrized distance.
  
          Find the intrinsic symmetrized geodesic distance between q0 and q1.
  
          Params:
              q0: the first quaternion
              q1: the second quaternion
  
          Returns:
             A positive amount corresponding to the length of the symmetrized
             geodesic curve connecting q0 to q1.
  
          Note:
             This formulation is more numerically stable when performing
             iterative gradient descent on the Riemannian quaternion manifold.
             However, the distance between q and -q is equal to pi, rendering this
             formulation not useful for measuring rotation similarities when the
             samples are spread over a "solid" angle of more than pi/2 radians
             (the spread refers to quaternions as point samples on the unit hypersphere).