code: def get_inertia(self):
          def calculate_inertia_tensor(molecule):
              masses = molecule.loc[:, 'mass'].values
              pos = molecule.loc[:, ['x', 'y', 'z']].values
              inertia = np.sum(
                  masses[:, None, None]
                  * ((pos**2).sum(axis=1)[:, None, None]
                     * np.identity(3)[None, :, :]
                     - pos[:, :, None] * pos[:, None, :]),
                  axis=0)
              diag_inertia, eig_v = np.linalg.eig(inertia)
              sorted_index = np.argsort(diag_inertia)
              diag_inertia = diag_inertia[sorted_index]
              eig_v = eig_v[:, sorted_index]
              return inertia, eig_v, diag_inertia
          molecule = self.add_data('mass')
          molecule = molecule - molecule.get_barycenter()
          inertia, eig_v, diag_inertia = calculate_inertia_tensor(molecule)
          eig_v = xyz_functions.orthonormalize_righthanded(eig_v)
          molecule = molecule.basistransform(eig_v)
          return {'transformed_Cartesian': molecule, 'eigenvectors': eig_v,
                  'diag_inertia_tensor': diag_inertia, 'inertia_tensor': inertia}