<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_mismatches(read, pair, mismatches, mm_option, req_map):
 """ - check to see if the read maps with <= threshold number of mismatches - mm_option = 'one' or 'both' depending on whether or not one or both reads in a pair need to pass the mismatch threshold - pair can be False if read does not have a pair - make sure alignment score is not 0, which would indicate that the read was not aligned to the reference """

    # if read is not paired, make sure it is mapped and that mm <= thresh
    if pair is False:
        mm = count_mismatches(read)
        if mm is False:
            return False
        # if no threshold is supplied, return True
        if mismatches is False:
            return True
        # passes threshold?
        if mm <= mismatches:
            return True
    # paired reads
    r_mm = count_mismatches(read)
    p_mm = count_mismatches(pair)
    # if neither read is mapped, return False
    if r_mm is False and p_mm is False:
        return False
    # if no threshold, return True
    if mismatches is False:
        return True
    # if req_map is True, both reads have to map
    if req_map is True:
        if r_mm is False or p_mm is False:
            return False
    ## if option is 'one,' only one read has to pass threshold
    if mm_option == 'one':
        if (r_mm is not False and r_mm <= mismatches) or (p_mm is not False and p_mm <= mismatches):
            return True
    ## if option is 'both,' both reads have to pass threshold
    if mm_option == 'both':
        ## if one read in pair does not map to the scaffold,
        ## make sure the other read passes threshold
        if r_mm is False:
            if p_mm <= mismatches:
                return True
        elif p_mm is False:
            if r_mm <= mismatches:
                return True
        elif (r_mm is not False and r_mm <= mismatches) and (p_mm is not False and p_mm <= mismatches):
            return True
    return False