import sqlite3


def has_review(username, restaurant_id):
    """
    return true if a user has made a review for a restaurant
    else return false
    """
    with sqlite3.connect("data/database.db") as db:
        c = db.cursor()
        review = c.execute('SELECT user FROM reviews WHERE user = ? AND restaurant = ?',
                           [username, restaurant_id])
        if len(review.fetchall()) == 0:
            return False
        return True