import bisect


def find(offset, sorted_list):
    """
    Binary search the sorted list
    Offset has to be between starting and ending position of reference
    """
    idx = bisect.bisect([ref_obj.ref_pos_start
                         for ref_obj in sorted_list], offset) - 1
    if idx < 0:
        return None
    ref_obj = sorted_list[idx]
    return ref_obj if ref_obj.ref_pos_end >= offset else None