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