#!/usr/bin/env python

data = [
        [70, 20],
        [70, 11],
        [60, 10],
        [55, 100],
        [56, 9],
        [60, 11],
        [60, 9],
        ]

rules = {'period': 60,
        'frequency': 10
        }

def data_filter(data, rules):

    result = []
    for d in data:
        data_result = {}
        if d[0] > rules['period']:
            print "ignore %s" %d
            continue
        elif d[1] >= rules['frequency']:
            data_result['data'] = d
            data_result['action'] = 'send aggregated'
        else:
            data_result['data'] = d
            data_result['action'] = 'send alone'
        result.append(data_result)

    return result


if __name__=='__main__':

    print data_filter(data, rules)
