Refactoring into a Python package