def _remove_unicode_keys(dictobj):
    if sys.version_info[:2] >= (3, 0): return dictobj

    assert isinstance(dictobj, dict)

    newdict = {}
    for key, value in dictobj.items():
        if type(key) is unicode:
            key = key.encode('utf-8')
        newdict[key] = value
    return newdict
Convert keys from 'unicode' to 'str' type.
dataset/ETHPy150Open ActiveState/applib/applib/_simpledb.py/_remove_unicode_keys