import collections
a = collections.OrderedDict()
for i in range(100):
    a[i] = i
import bisect
ind = bisect.bisect_left(list(a.keys()), 45.3)
Python: find closest key in a dictionary from the given input key