#NEWLINE# def timeout( self , function , args = ( ) , kwargs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , timeout = 30 ) : #NEWLINE# #INDENT# 'Wraps a normal thread of execution. Will raise TimeoutError when the\ntimeout value is reached.' #NEWLINE# to = self . add ( timeout , 1 , self . _timeout_cb ) #NEWLINE# try : #NEWLINE# #INDENT# return function ( * args , ** kwargs ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# self . remove ( args )