def _swap_keys(obj, key1, key2):
 (val1, val2) = (None, None)
 try:
  val2 = obj.pop(key1)
 except KeyError:
  pass
 try:
  val1 = obj.pop(key2)
 except KeyError:
  pass
 if (val2 is not None):
  obj[key2] = val2
 if (val1 is not None):
  obj[key1] = val1

def _swap_keys ( obj , key1 , key2 ) : ( val1 , val2 ) = ( None , None ) try : val2 = obj . pop ( key1 ) except KeyError : pass try : val1 = obj . pop ( key2 ) except KeyError : pass if ( val2 is not None ) : obj [ key2 ] = val2 if ( val1 is not None ) : obj [ key1 ] = val1
swap obj[key1] with obj[key2] .