Python: Timeout a function

Python: Timeout a function