from typing import Tuple
from typing import Dict


def key(product_: Tuple[str, Dict]) -> Tuple[float, float]:
    """Lemma 1 sorting key for the fixed attention problem.

    An optimal ranking for the fixed attention problem is sorted
    by this key function.

    Parameters
    ----------
        product_: tuple[str, dict]
            A tuple describing a product, the first element is its name
            or id, the second element is a dictionary describing its
            revenue if purchased and its probability of being
            purchased.

    Returns
    -------
        tuple:
            A tuple with the revenue of the product as first element
            and its probability as the second element.

    """

    return product_[1]["revenue"], product_[1]["probability"]