Fix bug where dummy_thread was always imported

The code always import the dummy_thread module even on platforms where the real thread module is available. This caused bugs in other packages try to import _thread in pyhton 2. 

try:
    from _thread import interrupt_main  # Py 3
except ImportError:
    from thread import interrupt_main  # Py 2

See  https://github.com/ipython/ipython/pull/7079