def convertPythonIndexToRowCol(s, i):
    """Convert index i into string s into zero-based row/col indices."""
    if not s or i <= 0:
        return 0, 0
    i = min(i, len(s))
    row = s.count('\n', 0, i)
    if row == 0:
        return row, i
    prevNL = s.rfind('\n', 0, i)
    return row, i - prevNL - 1
