def get_top_sorted_users(most_similar_users):
    '\n        INPUT:\n        most_similar_users - (list) an ordered list where the closest users (largest dot product users)\n                        are listed first \n                \n        OUTPUT:\n        neighbors_df - (pandas dataframe) a dataframe with:\n                        neighbor_id - is a neighbor user_id\n                        similarity - measure of the similarity of each user to the provided user_id\n                        num_interactions - the number of articles viewed by the user - if a u\n                        \n        Other Details - sort the neighbors_df by the similarity and then by number of interactions where \n                        highest of each is higher in the dataframe\n        \n        '
    df_user_id_grouped = df.groupby('user_id')
    df_user_id_grouped['article_id'].count().sort_values(ascending=False)
    neighbors_df = pd.DataFrame()
    neighbors_df['neighbor_id'] = most_similar_users
    user_item_tmp = user_item.copy()
    user_item_tmp[(user_item_tmp.isna() == True)] = 0
    row = user_item_tmp.loc[user_id]
    result_dot = (row @ user_item_tmp.T)
    result_dot.drop(labels=[user_id], inplace=True)
    similarity = result_dot.sort_values(ascending=False).values.tolist()[0:10]
    neighbors_df['similarity'] = similarity
    num_interactions = []
    for i in neighbors_df['neighbor_id']:
        counted_interaction = df_user_id_grouped['article_id'].count().loc[i]
        num_interactions.append(counted_interaction)
    neighbors_df['num_interactions'] = num_interactions
    neighbors_df = neighbors_df.sort_values(by=['similarity', 'num_interactions'], ascending=False)
    return neighbors_df
INPUT:
most_similar_users - (list) an ordered list where the closest users (largest dot product users)
                are listed first 
        
OUTPUT:
neighbors_df - (pandas dataframe) a dataframe with:
                neighbor_id - is a neighbor user_id
                similarity - measure of the similarity of each user to the provided user_id
                num_interactions - the number of articles viewed by the user - if a u
                
Other Details - sort the neighbors_df by the similarity and then by number of interactions where 
                highest of each is higher in the dataframe
def get_top_sorted_users(most_similar_users):
    '\n        INPUT:\n        most_similar_users - (list) an ordered list where the closest users (largest dot product users)\n                        are listed first \n                \n        OUTPUT:\n        neighbors_df - (pandas dataframe) a dataframe with:\n                        neighbor_id - is a neighbor user_id\n                        similarity - measure of the similarity of each user to the provided user_id\n                        num_interactions - the number of articles viewed by the user - if a u\n                        \n        Other Details - sort the neighbors_df by the similarity and then by number of interactions where \n                        highest of each is higher in the dataframe\n        \n        '
    df_user_id_grouped = df.groupby('user_id')
    df_user_id_grouped['article_id'].count().sort_values(ascending=False)
    neighbors_df = pd.DataFrame()
    neighbors_df['neighbor_id'] = most_similar_users
    user_item_tmp = user_item.copy()
    user_item_tmp[(user_item_tmp.isna() == True)] = 0
    row = user_item_tmp.loc[user_id]
    result_dot = (row @ user_item_tmp.T)
    result_dot.drop(labels=[user_id], inplace=True)
    similarity = result_dot.sort_values(ascending=False).values.tolist()[0:10]
    neighbors_df['similarity'] = similarity
    num_interactions = []
    for i in neighbors_df['neighbor_id']:
        counted_interaction = df_user_id_grouped['article_id'].count().loc[i]
        num_interactions.append(counted_interaction)
    neighbors_df['num_interactions'] = num_interactions
    neighbors_df = neighbors_df.sort_values(by=['similarity', 'num_interactions'], ascending=False)
    return neighbors_df