I find myself repeating the following code (or something similar) often:
users = {} for d in data: if d[\'user\'] in users.keys(): users[d[\'user\