@staticmethod
def check_hamil_is_herm(hamil):
    """
        Checks that the Hamiltonian hamil is a Hermitian operator. Emits
        warning and stops execution if it isn't.

        Parameters
        ----------
        hamil : QubitOperator

        Returns
        -------
        None

        """
    for term, coef in hamil.terms.items():
        coef = complex(coef)
        if abs(coef.imag) > 1e-08:
            assert False, 'The Hamiltonian should be Hermitian but it ' + "isn't. After being simplified by the " + 'BosonOperator constructor, ' + 'the coefficient of every term must be real.'
