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
We discussed this in person: we think that with a long enough list, this test fails fairly reliably without doing it in a loop. I just set the loop to 1 locally (with a list of 32), and got 4 failures in 5 runs. So @minrk will drop the for loop from this.