def valid_code(self, client_id, code):
        
        data = self.db.codes.find_one({'_id': code,
                                       'client_id': client_id})
        if data:
            return datetime.datetime.now() < data['expires']

        return False
Validates if a code is (still) a valid one. It takes two arguments:
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/MongoStorage.valid_code