def mkdate(datestring):
    return DT.datetime.strptime(datestring, '%Y-%m-%d').date()

def fortnight(date):
    return (date - start_date).days // 14
raw = '2010-08-01', '2010-06-25', '2010-07-01', '2010-07-08'
transactions = [(date, 'Some data') for date in map(mkdate, raw)]
transactions.sort(key=lambda date_data1: date_data1[0])
for key, grp in itertools.groupby(transactions, key=lambda date_data:
    fortnight(date_data[0])):
    pass
Group together arbitrary date objects that are within a time range of each other