<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sample_bad_readout(program, num_samples, assignment_probs, cxn):
 """ 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 """

    wf = cxn.wavefunction(program)
    return sample_outcomes(assignment_probs.dot(abs(wf.amplitudes.ravel())**2), num_samples)