code: def diagonal_basis_commutes(pauli_a, pauli_b):
      
      overlapping_active_qubits = set(pauli_a.get_qubits()) & set(pauli_b.get_qubits())
      for qubit_index in overlapping_active_qubits:
          if (pauli_a[qubit_index] != 'I' and pauli_b[qubit_index] != 'I' and
             pauli_a[qubit_index] != pauli_b[qubit_index]):
              return False
  
      return True
docs: Test if `pauli_a` and `pauli_b` share a diagonal basis
  
      Example:
  
          Check if [A, B] with the constraint that A & B must share a one-qubit
          diagonalizing basis. If the inputs were [sZ(0), sZ(0) * sZ(1)] then this
          function would return True.  If the inputs were [sX(5), sZ(4)] this
          function would return True.  If the inputs were [sX(0), sY(0) * sZ(2)]
          this function would return False.
  
      :param pauli_a: Pauli term to check commutation against `pauli_b`
      :param pauli_b: Pauli term to check commutation against `pauli_a`
      :return: Boolean of commutation result
      :rtype: Bool