def shift_mask_int(int_: int, r_shift: int, l_shift: int = 0, bits_oi: int = 0) -> int:
    """
    Shift integer right, extract bits_oi and left shift
    :param int_: integer to manipulate
    :param r_shift: bit shift right
    :param l_shift: final left shift
    :param bits_oi: bits of interest to keep
    :return: integer
    """
    return int_ >> r_shift & (2 ** bits_oi - 1) << l_shift