A JSON / hierarchical-data processing problem in two parts. Part 1 (Flatten): given a nested Python structure whose containers may be dict, list, or tuple and whose leaves are integers, extract all integers in traversal order as a flat list — e.g. {'a': [1, 2, 3], 'b': {'c': [{'d': 4}],…