#NEWLINE# def schedule_relative( self , duetime , action , state = None ) : #NEWLINE# #INDENT# 'Schedules an action to be executed after duetime.\n\n        Keyword arguments:\n        duetime -- {timedelta} Relative time after which to execute the action.\n        action -- {Function} Action to be executed.\n\n        Returns {Disposable} The disposable object used to cancel the scheduled\n        action (best effort).' #NEWLINE# scheduler = self #NEWLINE# msecs = self . to_relative ( duetime ) #NEWLINE# if ( msecs == 0 ) : #NEWLINE# #INDENT# return scheduler . schedule ( action , state ) #NEWLINE# #UNINDENT# disposable = SingleAssignmentDisposable ( ) #NEWLINE# def interval( ) : #NEWLINE# #INDENT# disposable . disposable = action ( scheduler , state ) #NEWLINE# #UNINDENT# log . debug ( 'timeout: %s' , msecs ) #NEWLINE# alarm = self . master . after ( state , interval ) #NEWLINE# def dispose( ) : #NEWLINE# #INDENT# self . master . after_cancel ( alarm ) #NEWLINE# #UNINDENT# return CompositeDisposable ( disposable , Disposable ( dispose ) )