code: def check_mismatches(read, pair, mismatches, mm_option, req_map):
      if pair is False:
          mm = count_mismatches(read)
          if mm is False:
              return False
          if mismatches is False:
              return True
          if mm <= mismatches:
              return True
      r_mm = count_mismatches(read)
      p_mm = count_mismatches(pair)
      if r_mm is False and p_mm is False:
          return False
      if mismatches is False:
          return True
      if req_map is True:
          if r_mm is False or p_mm is False:
              return False
      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 mm_option == 'both':
          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