from typing import Dict
import random


def sample_from_distr(distribution: Dict[int, float]) -> int:
    """Utility function for sampling from distribution.

    Parameters
    ----------
    distribution : Dict[int, float]

    Returns
    -------
    int
        Sampled int key weighted by float values

    """
    keys = list(distribution.keys())
    values = list(distribution.values())
    return random.choices(population=keys, weights=values, k=1)[0]