def data2_in_range(min_value, max_value):
    """ Returns a function that matches data2 to a range of values.
    The value is matched if data2 falls between min_value and max_value
    inclusively.
    """
    return lambda m: min_value <= m.data2 <= max_value