import random


def weighted_choice(choices):
    """Returns a value from choices chosen by weighted random selection
    choices should be a list of (value, weight) tuples.

    Examples:
        weighted_choice([('val1', 5), ('val2', 0.3), ('val3', 1)])
    """
    values, weights = zip(*choices)
    value = random.choices(population=values, weights=weights, k=1)[0]
    return value