Properly check for Python 2 to avoid converting map names to bytes in
Python 3
Use importlib instead of __import__