This is renaming keys in-place, which means that after saving the notebook, all of the outputs in-memory will have short keys, not mime keys. It might be best to copy:

```javascript
var remapped = {};
for (var key in data) {
    var new_key = key_map[key] || key;
    remapped[new_key] = data[key];
}
return remapped;
```

This is a testable case, hooray! Check that after calling notebook.toJSON, all outputs still have mime-type keys.