def hasAverageMassWithinRange(min_mass, max_mass):
    """
    Checks if the average mass in Da is within [min_mass, max_mass] range
    """

    def _filter(term):
        return min_mass <= term['_sf'].average_mass() <= max_mass

    return _filter