def pass_qc(qc, marker_perc, min_comp, max_cont, min_quality, sh_exception,
    min_perc_markers, max_contigs, min_N50, max_ambiguous, failed_tests):
    """Check if genome passes QC."""
    failed = False
    if qc.checkm_completeness < min_comp:
        failed_tests['comp'] += 1
        failed = True
    if qc.checkm_strain_heterogeneity_100 >= sh_exception:
        if qc.checkm_contamination > 20:
            failed_tests['cont'] += 1
            failed = True
        q = qc.checkm_completeness - 5 * qc.checkm_contamination * (1.0 - 
            qc.checkm_strain_heterogeneity_100 / 100.0)
        if q < min_quality:
            failed_tests['qual'] += 1
            failed = True
    else:
        if qc.checkm_contamination > max_cont:
            failed_tests['cont'] += 1
            failed = True
        q = qc.checkm_completeness - 5 * qc.checkm_contamination
        if q < min_quality:
            failed_tests['qual'] += 1
            failed = True
    if marker_perc < min_perc_markers:
        failed_tests['marker_perc'] += 1
        failed = True
    if qc.contig_count > max_contigs:
        failed_tests['contig_count'] += 1
        failed = True
    if qc.n50_contigs < min_N50:
        failed_tests['N50'] += 1
        failed = True
    if qc.ambiguous_bases > max_ambiguous:
        failed_tests['ambig'] += 1
        failed = True
    return not failed
