Pure-Python Bencode implementation