def rekey(dikt):
    for k in dikt.keys():
        if isinstance(k, str):
            ik=fk=None
            try:
                ik = int(k)
            except ValueError:
                try:
                    fk = float(k)
                except ValueError:
                    continue
            if ik is not None:
                nk = ik
            else:
                nk = fk
            if nk in dikt:
                raise KeyError("already have key %r"%nk)
            dikt[nk] = dikt.pop(k)
    return dikt
Read terminal status line: Carrier Detect
dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/jsonutil.py/rekey--crossover with--dataset/ETHPy150Open Robot-Will/Stino/stino/pyarduino/base/pyserial/serialwin32.py/Win32Serial.getCD