code: def get_top_n(predictions, n=10):
      """Return the top-N recommendation for each user from a set of predictions.
  
      Args:
          predictions(list of Prediction objects): The list of predictions, as
              returned by the test method of an algorithm.
          n(int): The number of recommendation to output for each user. Default
              is 10.
  
      Returns:
      A dict where keys are user (raw) ids and values are lists of tuples:
          [(raw item id, rating estimation), ...] of size n.
      """
  
      # First map the predictions to each user.
      top_n = defaultdict(list)
      for uid, iid, true_r, est, _ in predictions:
          top_n[uid].append((iid, est))
  
      # Then sort the predictions for each user and retrieve the k highest ones.
      for uid, user_ratings in top_n.items():
          user_ratings.sort(key=lambda x: x[1], reverse=True)
          top_n[uid] = user_ratings[:n]
  
      return top_n
  
label_desc: Use image node_id 1 for calling a global function with example usage: get_top_n(predictions, n) and returns: top_n