The imp module is deprecated in recent versions of python3. Rework the module existence testing for that case using importlib.