def get_percentile(N, percent, key=lambda x:x):
    if not N:
        return 0
    k = (len(N)-1) * percent
    f = math.floor(k)
    c = math.ceil(k)
    if f == c:
        return key(N[int(k)])
    d0 = key(N[int(f)]) * (c-k)
    d1 = key(N[int(c)]) * (k-f)
    return d0+d1
Custom role to evaluate Python expressions.
dataset/ETHPy150Open radlab/sparrow/src/main/python/parse_logs.py/get_percentile--crossover with--dataset/ETHPy150Open ganeti/ganeti/lib/build/sphinx_ext.py/PythonEvalRole