def create_ground_truth(user_data):
    """Given user data, return a dictionary of labels of users and reviews
    Args:
        user_data: key = user_id, value = list of review tuples.
    Return:
        user_ground_truth: key = user id (not prefixed), value = 0 (non-spam) /1 (spam)
        review_ground_truth: review id (not prefixed), value = 0 (non-spam) /1 (spam)
    """
    user_ground_truth = {}
    review_ground_truth = {}

    for user_id, reviews in user_data.items():

        user_ground_truth[user_id] = 0

        for r in reviews:
            prod_id = r[0]
            label = r[2]

            if label == -1:
                review_ground_truth[(user_id, prod_id)] = 1
                user_ground_truth[user_id] = 1
            else:
                review_ground_truth[(user_id, prod_id)] = 0

    return user_ground_truth, review_ground_truth