http://www.regexprn.com/2010/05/killing-multithreaded-python-programs.html

You can use `observer.join(1)` instead of `time.sleep`.