code: def diagonalize(operator):
      
      eig_values, eig_vecs = LA.eigh(operator)
      emin = np.amin(eig_values)
      eig_values -= emin
  
      return eig_values, eig_vecs
docs: diagonalizes single site Spin Hamiltonian