Get keys from a namespace

def keys(self, namespace, prefix=None, limit=None, offset=None):
        """Get keys from a namespace"""
        params = [namespace]
        query = 'SELECT key FROM gauged_keys WHERE namespace = %s'
        if prefix is not None:
            query += ' AND key LIKE %s'
            params.append(prefix + '%')
        if limit is not None:
            query += ' LIMIT %s'
            params.append(limit)
        if offset is not None:
            query += ' OFFSET %s'
            params.append(offset)
        cursor = self.cursor
        cursor.execute(query, params)
        return [key for key, in cursor]