def find_prev_sel(trans_sels, current_sel):
    """Find the region in `trans_sels` that is right before `current_sel`.
    Assume `trans_sels` is sorted.
    """
    for i in range(len(trans_sels) - 1, -1, -1):
        if trans_sels[i].begin() == current_sel.begin():
            return i, trans_sels[i]

    # Rotate to the last if `current_sel` is before all other selections
    return -1, trans_sels[-1]
dataset/ETHPy150Open MaokaiLin/PowerCursors/power_cursors.py/find_prev_sel/operator `<` -> `==`