utils: Implement a safer version of defaultdict which auto-deletes keys when value == default