def item_based_predict(movie_data, u, m1, nn_list):
    """Returns a prediction from parameters for a movie.

        Parameters
        ----------
        movie_data : dict
            Dictionary of the data set.

        u : str
            Id of user to be used for prediction.

        m1 : str
            Id of movie to be used for prediction.

        nn_list: list
            List of k-nearest-neighbors of m1.
            [ (movie, similarity) ]

        Returns
        -------
        prediction : float
            Returns a rating.
    """
    numer = 0
    denom = 0

    for tup in nn_list:
        m2 = tup[0]
        sim = tup[1]
        r_u = 0

        if u in movie_data[m2]:
            r_u = movie_data[m2][u]
        else:
            continue

        numer += sim * r_u
        denom += sim

    if denom == 0:
        return -1

    return round(numer / denom, 16)