code: def _get_reciprocal_rank(
      rating_true,
      rating_pred,
      col_user=DEFAULT_USER_COL,
      col_item=DEFAULT_ITEM_COL,
      col_prediction=DEFAULT_PREDICTION_COL,
      relevancy_method="top_k",
      k=DEFAULT_K,
      threshold=DEFAULT_THRESHOLD,
  ):
      df_hit, df_hit_count, n_users = merge_ranking_true_pred(
          rating_true=rating_true,
          rating_pred=rating_pred,
          col_user=col_user,
          col_item=col_item,
          col_prediction=col_prediction,
          relevancy_method=relevancy_method,
          k=k,
          threshold=threshold,
      )
  
      if df_hit.shape[0] == 0:
          return None, n_users
  
      # calculate reciprocal rank of items for each user and sum them up
      df_hit_sorted = df_hit.copy()
      df_hit_sorted["rr"] = (
          df_hit_sorted.groupby(col_user).cumcount() + 1
      ) / df_hit_sorted["rank"]
      df_hit_sorted = (
          df_hit_sorted.groupby(col_user)
          .agg({"rr": "sum"})
          .reset_index()
      )
  
      return pd.merge(df_hit_sorted, df_hit_count, on=col_user), n_users
  
imports: import numpy
  import pandas
  from functools import wraps
  from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score, explained_variance_score, roc_auc_score, log_loss
  from recommenders.utils.constants import DEFAULT_USER_COL, DEFAULT_ITEM_COL, DEFAULT_RATING_COL, DEFAULT_PREDICTION_COL, DEFAULT_RELEVANCE_COL, DEFAULT_SIMILARITY_COL, DEFAULT_ITEM_FEATURES_COL, DEFAULT_ITEM_SIM_MEASURE, DEFAULT_K, DEFAULT_THRESHOLD
  from recommenders.datasets.pandas_df_utils import has_columns, has_same_base_dtype, lru_cache_df
label_desc: Use image node_id 13 for calling a global function with example usage: _get_reciprocal_rank(rating_true, rating_pred, col_user, col_item, col_prediction, relevancy_method, k, threshold) and returns: pd,  n_users, None,  n_users