Python version of C++ code