python: Added a safety timeout in the new-thread wait loop.