import bisect


def GetOffset(value, breakpoints, endpoints, offsets):
    """return offset for a given coordinate."""

    pos = bisect.bisect(endpoints, value)
    if pos == len(breakpoints):
        return offsets[-1]

    return offsets[pos]