We recommend the following resources for porting extension modules to Python 3:
The Porting guide from the py3c project provides opinionated
suggestions with supporting code.
The CFFI libraries offer abstractions over
Python's C API.
Extensions generally need to be re-written to use one of them,
but the library then handles differences between various Python
versions and implementations.