def extract_sample_qc_status(qc_file_handle, file_label):
    """Parses a MEND QC results file handle to "PASS" or "FAIL".
    QC results parsing to something else (or failing to parse) indicate a major
    failure in the QC script and should interrupt analysis.
    The qc_file_handle is as provided by TarFile.extractfile, ie, in raw bytes"""
    # Expected File format (example. Has PASS\n or FAIL\n at end of second line
    # input	uniqMappedNonDupeReadCount	estExonicUniqMappedNonDupeReadCount	qc\n
    # sample1.readDist.txt	22333444.5	10999888.765	PASS\n
    status = qc_file_handle.readlines()[1][-5:-1].decode("utf-8")
    if not status in ["PASS", "FAIL"]:
        print("ERROR: MEND QC file {} parsed status as '{}' - expected PASS or FAIL!".format(file_label, status))
        raise ValueError
    return status