First, you can’t just transport straight C for loops into Python. There has to be some concession ... the source code ahead of processing and make whichever changes you see fit.