code: def do_state_tomography(preparation_program, nsamples, cxn, qubits=None, use_run=False):
      
      return tomography._do_tomography(preparation_program, nsamples, cxn, qubits,
                                       tomography.MAX_QUBITS_STATE_TOMO,
                                       StateTomography, state_tomography_programs,
                                       DEFAULT_STATE_TOMO_SETTINGS, use_run=use_run)
docs: Method to perform both a QPU and QVM state tomography, and use the latter as
      as reference to calculate the fidelity of the former.
  
      :param Program preparation_program: Program to execute.
      :param int nsamples: Number of samples to take for the program.
      :param QVMConnection|QPUConnection cxn: Connection on which to run the program.
      :param list qubits: List of qubits for the program.
      to use in the tomography analysis.
      :param bool use_run: If ``True``, use append measurements on all qubits and use ``cxn.run``
          instead of ``cxn.run_and_measure``.
      :return: The state tomogram.
      :rtype: StateTomography