code: def state_tomography_programs(state_prep, qubits=None,
                                rotation_generator=tomography.default_rotations):
      
      if qubits is None:
          qubits = state_prep.get_qubits()
      for tomography_program in rotation_generator(*qubits):
          state_tomography_program = Program(Pragma("PRESERVE_BLOCK"))
          state_tomography_program.inst(state_prep)
          state_tomography_program.inst(tomography_program)
          state_tomography_program.inst(Pragma("END_PRESERVE_BLOCK"))
          yield state_tomography_program
docs: Yield tomographic sequences that prepare a state with Quil program `state_prep` and then append
      tomographic rotations on the specified `qubits`. If `qubits is None`, it assumes all qubits in
      the program should be tomographically rotated.
  
      :param Program state_prep: The program to prepare the state to be tomographed.
      :param list|NoneType qubits: A list of Qubits or Numbers, to perform the tomography on. If
      `None`, performs it on all in state_prep.
      :param generator rotation_generator: A generator that yields tomography rotations to perform.
      :return: Program for state tomography.
      :rtype: Program