code: def basis_state_preps(*qubits):
      
      for prep in cartesian_product([I, X], repeat=len(qubits)):
          basis_prep = Program(Pragma("PRESERVE_BLOCK"))
          for gate, qubit in zip(prep, qubits):
              basis_prep.inst(gate(qubit))
          basis_prep.inst(Pragma("END_PRESERVE_BLOCK"))
          yield basis_prep
docs: Generate a sequence of programs that prepares the measurement
      basis states of some set of qubits in the order such that the qubit
      with highest index is iterated over the most quickly:
      E.g., for ``qubits=(0, 1)``, it returns the circuits::
  
          I_0 I_1
          I_0 X_1
          X_0 I_1
          X_0 X_1
  
      :param list qubits: Each qubit to include in the basis state preparation.
      :return: Yields programs for each basis state preparation.
      :rtype: Program