bencode serialize/deserialize written with c++, with pybind11.
pip install bencode-cpp
import bencode_cpp
# NOTICE: we decode bencode bytes to bytes, not str.
assert bencode_cpp.bdecode(b'd5:hello5:worlde') == {b'hello': b'world'}
assert bencode_cpp.bencode(...) == b'...'