Make dict_swap work on older Pythons