def METHOD_NAME(
    self,
    items: DataFrame,
    metric: Optional[str] = None,
    candidates: Optional[DataFrame] = None,
) -> DataFrame:
    similarity_filtered = self.similarity.join(
        items.withColumnRenamed("item_idx", "item_idx_one"),
        on="item_idx_one",
    )
    if candidates is not None:
        similarity_filtered = similarity_filtered.join(
            candidates.withColumnRenamed("item_idx", "item_idx_two"),
            on="item_idx_two",
        )
    return similarity_filtered.select(
        "item_idx_one",
        "item_idx_two",
        "similarity" if metric is None else metric,
    )