def chooseFromDistribution(distribution):
    if isinstance(distribution, dict) or isinstance(distribution, Counter):
        return sample(distribution)
    r = random.random()
    base = 0.0
    for prob, element in distribution:
        base += prob
        if r <= base:
            return element
Return plain text version of debug 500 HTTP error page.
dataset/ETHPy150Open rlpy/rlpy/rlpy/Domains/PacmanPackage/util.py/chooseFromDistribution--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/views/debug.py/ExceptionReporter.get_traceback_text