code: def principal_axis(inertia):
      
      inertia = np.asanyarray(inertia, dtype=np.float64)
      if inertia.shape != (3, 3):
          raise ValueError('inertia tensor must be (3,3)!')
  
      # you could any of the following to calculate this:
      # np.linalg.svd, np.linalg.eig, np.linalg.eigh
      # moment of inertia is square symmetric matrix
      # eigh has the best numeric precision in tests
      components, vectors = np.linalg.eigh(inertia * negate_nondiagonal)
  
      # eigh returns them as column vectors, change them to row vectors
      vectors = vectors.T
  
      return components, vectors
docs: Find the principal components and principal axis
      of inertia from the inertia tensor.
  
      Parameters
      ------------
      inertia : (3,3) float
        Inertia tensor
  
      Returns
      ------------
      components : (3,) float
        Principal components of inertia
      vectors : (3,3) float
        Row vectors pointing along the
        principal axes of inertia