I have a data structure which essentially amounts to a nested dictionary. Let's say it looks like this: