wouldn't it be simpler to do something like:

idx = np.argmin(np.abs(time - times))

after checking that time lies between times[0] and times[-1] even though I think it's a reasonable behavior to return times[0] if time < times[0] ...

wdyt?