Fold this into a package

Is there no better way to do this than parsing Python with Python?