#NEWLINE# def get( self ) : #NEWLINE# #INDENT# with self . _lock : #NEWLINE# #INDENT# if self . _dead : #NEWLINE# #INDENT# ( ts , revived ) = self . _dead . pop ( ) #NEWLINE# if ( ts > time . time ( ) ) : #NEWLINE# #INDENT# self . _dead . append ( ( self , revived ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _servers . append ( revived ) #NEWLINE# logger . info ( 'Server %r reinstated into working pool' , revived ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not self . _servers ) : #NEWLINE# #INDENT# logger . critical ( 'No servers available' ) #NEWLINE# raise NoServerAvailable ( ) #NEWLINE# #UNINDENT# return random . choice ( self . _servers )