I\'m trying to implement something like this in python:
obj = MyObj() obj.run_task() # if run_task() takes more than 10 seconds. obj.clean_exit() # contains