code: def remove_imaginary_terms(pauli_sums: PauliSum) -> PauliSum:
      
      if not isinstance(pauli_sums, PauliSum):
          raise TypeError("not a pauli sum. please give me one")
      new_term = sI(0) * 0.0
      for term in pauli_sums:
          new_term += term_with_coeff(term, term.coefficient.real)
  
      return new_term
docs: Remove the imaginary component of each term in a Pauli sum.
  
      :param pauli_sums: The Pauli sum to process.
      :return: a purely Hermitian Pauli sum.