The standard library has containers for recurring application jobs. Counter tracks how often values occur. defaultdict creates a separate value for a missing key. deque supports work at either end and can keep bounded history. ChainMap searches several mappings in precedence order without first copying them into one dictionary.
These tools save branching, but their contracts still matter. A repeated event should increase a count. Pickup ids retain their original order inside a group even when group names are sorted. A zero-length history keeps nothing. And an empty configuration string can be an intentional override. You will write small transformations for each container and return plain lists so their behavior is easy to test independently of presentation.