lemon C++ library port to Python