Fix Python 3 compatibility.

Added compatibility to run mine.py as-is with Python 3.
Of course, I did not break Python 2 compatibility.