def build_rating_list(name_to_rating, names_final):
    """(dict of {str: int}, list of str) -> list of list of [int, str]

    Return a list of [rating%, restaurant name], sorted by rating%

    >>> name_to_rating = {  'Georgie Porgie': 87,
                    'Queen St. Cafe': 82,
                    'Dumplings R Us': 71,
                    'Mexican Grill': 85,
                    'Deep Fried Everything': 52}
    >>> names_final = ['Queen St. Cafe', 'Dumplings R Us']
    >>> build_rating_list(name_to_rating, names_final)
    [[82, 'Queen St. Cafe'], [71, 'Dumplings R Us']]
    """

    result = list()

    # Go through final restaurant names and select rating from other dict.
    # Create list of lists with restaurant name and rating.
    for name in names_final:
        rating = name_to_rating[name]
        name_and_ratings = list()
        name_and_ratings.append([rating, name])
        result.append(name_and_ratings)

    result.sort(reverse=True)

    return result