all_second_keys = set(key for value in d.values() for key in value)
for value in d.values():
    value.update((key, 0) for key in all_second_keys if key not in value)
how to get all the keys in a 2d dict python