Fixing imports for Python 2 and PyPy.