def filter_on_average(rec, q = 20):
    """ Returns True if the supplied sequence record passes the quality threshold.
        Default threshold is 20.
    """
    qScores = rec.letter_annotations["phred_quality"]
    if (sum(qScores)/len(qScores)) < q:
        return False
    
    return True