[PyCUDA] C++ to Python code conversion help