Simple bencode implementation in python