Ensure that a copy of the keys is taken otherwise Python 3 is modifying the key list on-the-fly, causing some keys to be missed