Fix import for python2 and pypy