<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def random_weighted_choice(choices):
 """ Return a random key of choices, weighted by their value. :param choices: a dictionary of keys and positive integer pairs; :return: a random key of choices. """

    choices, weights = zip(*choices.items())
    cumdist = list(accumulate(weights))
    x = random.random() * cumdist[-1]
    element = bisect.bisect(cumdist, x)
    return choices[element]