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

    EXAMPLES::

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

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

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

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

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

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

    ..  SEEALSO::

        :meth:`right`, :meth:`top`, :meth:`bottom`
    """
    if sp.row_lengths()[row_index] == 0:
        return None
    outer_row_lengths = sp.outer().to_list()
    inner_row_lengths = sp.inner().to_list()
    if row_index in range(len(outer_row_lengths)) and row_index not in range(
        len(inner_row_lengths)):
        inner_row_length = 0
    else:
        inner_row_length = inner_row_lengths[row_index]
    col_index = inner_row_length
    return col_index
