Better imports

Narrowed down the scope of the imports, after checking out compat.py as
suggested, testsuite is happy.