defaultdict(lambda: defaultdict(int))
x = collections.defaultdict(collections.Counter) x['foo']['bar'] += 1 X['foo'].most_common(10) Etc.