def histogram(iterable, k=10, range=None):
    # To loop through the intervals in sorted order, use:
    # for (i, j), values in sorted(histogram(iterable).items()):
    #     m = i + (j - i) / 2 # midpoint
    #     print(i, j, m, values)
    a = iterable if isinstance(iterable, list) else list(iterable)
    r = range or (min(a), max(a))
    k = max(int(k), 1)
    w = float(r[1] - r[0] + 0.000001) / k # interval (bin width)
    h = [[] for i in xrange(k)]
    for x in a:
        i = int(floor((x - r[0]) / w))
        if 0 <= i < len(h): 
            #print(x, i, "(%.2f, %.2f)" % (r[0] + w * i, r[0] + w + w * i))
            h[i].append(x)
    return dict(((r[0] + w * i, r[0] + w + w * i), v) for i, v in enumerate(h))

#--- MOMENT ----------------------------------------------------------------------------------------
Translate fio parameters into a job config file.
dataset/ETHPy150Open clips/pattern/pattern/metrics.py/histogram--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/linux_packages/fio.py/FioParametersToJob