keepnick.py: make script compatible with Python 3.x