def right(sp, row_index):
    """ Given a SkewPartition and a 0-based row index, return the 0-based column index of the *rightmost* cell in the corresponding row.  (Section 2.1 of [mem]_)

    EXAMPLES::

        sage: right(SkewPartition([[4, 1], [2]]), 0)
        3

        sage: right(SkewPartition([[4, 1], [2]]), 1)
        0

    An input index that is out of the bounds of the skew partition will throw an error::

        sage: right(SkewPartition([[4, 1], [2]]), 2)
        IndexError: list index out of range

    An in-bounds index where no cells exist will return ``None``::

        sage: right(SkewPartition([[2, 1, 1, 1], [1, 1]]), 1) == None
        True

    ..  SEEALSO::

        :meth:`left`, :meth:`top`, :meth:`bottom`
    """
    if sp.row_lengths()[row_index] == 0:
        return None
    outer_row_lengths = sp.outer().to_list()
    outer_row_length = outer_row_lengths[row_index]
    col_index = outer_row_length - 1
    return col_index
