import random


def pick_item(items):
    """Do a weighted pick from a list of items."""
    weights = [item['weight'] for item in items]
    target = random.uniform(0, sum(weights))

    cum_total = 0.0

    for w, weight in enumerate(weights):
        cum_total += weight
        if target < cum_total:
            return items[w]