def percentile(sequence, percent):
    if not sequence:
        return None

    values = sorted(sequence)

    if percent == 0:
        return values[0]

    pos = int(len(values) * percent) - 1

    return values[pos]
dataset/ETHPy150Open grantjenks/python-diskcache/tests/utils.py/percentile/original