I see that you are interfacing with Python through XS. With Inline::Python, that can all be done automatically for you!