code: def sample_bad_readout(program, num_samples, assignment_probs, cxn):
      
      wf = cxn.wavefunction(program)
      return sample_outcomes(assignment_probs.dot(abs(wf.amplitudes.ravel())**2), num_samples)
docs: Generate `n` samples of measuring all outcomes of a Quil `program`
      assuming the assignment probabilities `assignment_probs` by simulating the
      wave function on a qvm QVMConnection `cxn`
  
      :param pyquil.quil.Program program: The program.
      :param int num_samples: The number of samples
      :param numpy.ndarray assignment_probs: A matrix of assignment probabilities
      :param QVMConnection cxn: the QVM connection.
      :return: The resulting sampled outcomes from assignment_probs applied to cxn, one dimensional.
      :rtype: numpy.ndarray