don’t modify dict keys while iterating through them

in `jsonutil.rekey`, which could prevent some keys from being modified during the iteration.

closes #5901

Fixes 'unorderable types' failure on Python 3 in test_client:

```
File "/usr/lib/python3.4/unittest/case.py", line 57, in testPartExecutor
    yield
File "/usr/lib/python3.4/unittest/case.py", line 574, in run
    testMethod()
File "/usr/local/lib/python3.4/site-packages/IPython/parallel/tests/test_client.py", line 193, in test_queue_status
    intkeys = sorted(intkeys)
unorderable types: int() < str()
```

ping @takluyver
Can re-running this in process actually cause the failure? So it's not due to dictionary randomisation, because the seed is only set once when Python starts.