Update: New file (paginator.py) for re-usable pagination in Python.