nkit C++ library port to Python