def weighted_choice(choices):
total = sum(weight for choice, weight in choices)<EOL>rand = random.uniform(<NUM_LIT:0>, total)<EOL>most = <NUM_LIT:0><EOL>for choice, weight in choices:<EOL><INDENT>if most + weight > rand:<EOL><INDENT>return choice<EOL><DEDENT>most += weight<EOL><DEDENT>
Provides a weighted version of random.choice
:param choices: A dictionary of choices, with the choice as the key and weight the value
:type  choices: list of tuple of (str, int)