#NEWLINE# def valid_code( self , client_id , code ) : #NEWLINE# #INDENT# 'Validates if a code is (still) a valid one. It takes two arguments:\n        * The client application ID\n        * The temporary code given by the application\n        It returns True if the code is valid. Otherwise, False\n        ' #NEWLINE# data = self . db . codes . find_one ( { #NEWLINE# #INDENT# '_id' : code , #NEWLINE# 'client_id' : client_id , #NEWLINE# #UNINDENT# } ) #NEWLINE# if data : #NEWLINE# #INDENT# return ( datetime . datetime . now ( ) < client_id [ 'expires' ] ) #NEWLINE# #UNINDENT# return False