code: def kabsch_rotate(P, Q):
      
      U = kabsch(P, Q)
  
      # Rotate P
      P = np.dot(P, U)
      return P
docs: Rotate matrix P unto matrix Q using Kabsch algorithm.
  
      Parameters
      ----------
      P : array
          (N,D) matrix, where N is points and D is dimension.
      Q : array
          (N,D) matrix, where N is points and D is dimension.
  
      Returns
      -------
      P : array
          (N,D) matrix, where N is points and D is dimension,
          rotated