Open this example in the interactive library
Source code
from collections import defaultdict
by_team = defaultdict(lambda: defaultdict(int))
by_team['design']['open'] += 1
print({team: dict(counts) for team, counts in by_team.items()})Sample output
{'design': {'open': 1}}