#NEWLINE# def ExecuteAfterDelay( time_s , func , * args , **kwargs ) : #NEWLINE# #INDENT# 'A function that executes the given function after a delay.\n\n  Executes func in a separate thread after a delay, so that this function\n  returns immediately.  Note that any exceptions raised by func will be\n  ignored (but logged).  Also, if time_s is a PolledTimeout with no expiration,\n  then this method simply returns immediately and does nothing.\n\n  Args:\n    time_s: Delay in seconds to wait before executing func, may be a\n      PolledTimeout object.\n    func: Function to call.\n    *args: Arguments to call the function with.\n    **kwargs: Keyword arguments to call the function with.\n  ' #NEWLINE# timeout = PolledTimeout . FromSeconds ( time_s ) #NEWLINE# def Target( ) : #NEWLINE# #INDENT# time . sleep ( timeout . remaining ) #NEWLINE# try : #NEWLINE# #INDENT# func ( * args , ** kwargs ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# _LOG . exception ( 'Error executing %s after %s expires.' , func , timeout ) #NEWLINE# #UNINDENT# #UNINDENT# if ( timeout . remaining is not None ) : #NEWLINE# #INDENT# thread = threading . Thread ( target = Target ) #NEWLINE# thread . start ( )