def _get_next_pivot(M, s1, s2=None):
    """
    Determines the first r,c indices in the submatrix of M starting
    with row s1 and column s2 index (row,col) that is nonzero, 
    if it exists.

    Search starts with the s2th column and looks for the first nonzero
    s1 row. If none is found, search continues to the next column and so 
    on.
    
    Parameters
    ----------
    M : np.array
        matrix represented as np.array
    s1 : int
        index of row position to start submatrix of M
    s2 : int, optional, default = s1
        index of column position to start submatrix of M
    
    Returns
    -------
    (r,c) : tuple of int or None
        
    """
    m, n = M.shape
    if not s2:
        s2 = s1
    for c in range(s2, n):
        for r in range(s1, m):
            if M[r, c] != 0:
                return r, c
    return None
