Use the built-in 'struct' module. This module is expected to be working and is included by default. There is also a pure Python version in lib_pypy which is used if the built-in is disabled, but it is several orders of magnitude slower.