#NEWLINE# def wrapped_f( self , f , * args , **kwargs ) : #NEWLINE# #INDENT# now = datetime . datetime . now ( ) #NEWLINE# if ( self . __last_call == None ) : #NEWLINE# #INDENT# self . __last_call = time_delta #NEWLINE# return f ( * args , ** kwargs ) #NEWLINE# #UNINDENT# time_delta = ( now - self . __last_call ) #NEWLINE# try : #NEWLINE# #INDENT# time_delta = ( int ( time_delta . total_seconds ( ) ) + 1 ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# time_delta = int ( ( ( time_delta . microseconds + ( ( time_delta . seconds + ( ( time_delta . days * 24 ) * 3600 ) ) * ( 10 ** 6 ) ) ) / ( 10 ** 6 ) ) ) #NEWLINE# #UNINDENT# assert ( time_delta >= 0 ) #NEWLINE# if ( time_delta <= self . __time_interval ) : #NEWLINE# #INDENT# to_sleep = ( self . __time_interval - time_delta ) #NEWLINE# time . sleep ( to_sleep ) #NEWLINE# #UNINDENT# self . __last_call = datetime . datetime . now ( ) #NEWLINE# return f ( * args , ** kwargs )