for rowdict in example:
    if not maxiddict.get(rowdict['id']) or rowdict['seq'] > maxiddict.get(
        rowdict['id'])[0]:
        if not maxiddict.get(rowdict['id']):
            maxiddict[rowdict['id']] = [rowdict['seq'], rowdict['sum'],
                rowdict['foo'], rowdict['foo']]
else:
    first_foo = maxiddict[rowdict['id']][2]
maxiddict[rowdict['id']] = [rowdict['seq'], rowdict['sum'], first_foo,
    rowdict['foo']]
groupdict = {}
for k, v in list(maxiddict.items()):
    pass
Get max values by category in list of dictionaries