def decode_dict(x, f):
    r, f = {}, f+1
    lastkey = None
    while x[f] != 'e':
        k, f = decode_string(x, f)
        if lastkey >= k:
            raise ValueError
        lastkey = k
        r[k], f = decode_func[x[f]](x, f)
    return (r, f + 1)
dataset/ETHPy150Open Cclleemm/FriendlyTorrent/src/tornado/BitTornado/bencode.py/decode_dict/original