#NEWLINE# def _keep_alive( self , n_pending_tasks , n_unique_pending ) : #NEWLINE# #INDENT# '\n        Returns true if a worker should stay alive given.\n\n        If worker-keep-alive is not set, this will always return false.\n        For an assistant, it will always return the value of worker-keep-alive.\n        Otherwise, it will return true for nonzero n_pending_tasks.\n\n        If worker-count-uniques is true, it will also\n        require that one of the tasks is unique to this worker.\n        ' #NEWLINE# if ( not self . _config . keep_alive ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . _assistant : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( n_pending_tasks and ( n_unique_pending or ( not self . _config . count_uniques ) ) )