#NEWLINE# @ utils . Synchronized #NEWLINE# def NewNonce( self ) : #NEWLINE# #INDENT# 'Generates a new random, unique nonce to use for authentication.' #NEWLINE# now = time . time ( ) #NEWLINE# if ( len ( self . nonces ) >= self . MAX_NONCES ) : #NEWLINE# #INDENT# self . _InvalidateOldNonces ( now ) #NEWLINE# return None #NEWLINE# #UNINDENT# nonce = str ( uuid . uuid4 ( ) ) #NEWLINE# if ( self in self . nonces ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( len ( self . nonces ) >= ( self . MAX_NONCES / 10 ) ) : #NEWLINE# #INDENT# self . _InvalidateOldNonces ( now ) #NEWLINE# #UNINDENT# self . nonces [ nonce ] = now #NEWLINE# return nonce