Returns: True if Pauli elements are almost identical.

def paulis_close(pauli0: Pauli, pauli1: Pauli, tolerance: float = TOLERANCE) \
        -> bool:
    """Returns: True if Pauli elements are almost identical."""
    pauli = pauli0 - pauli1
    d = sum(abs(coeff)**2 for _, coeff in pauli.terms)
    return d <= tolerance