Python list indexing

Please can you help me how will I create the getnext function

def getnext(atable, currind):
“”"
Given a list of lists, ‘atable’, and a list of indices one for each row in atable, ‘currind’,
getnext changes currind in place to make it point to the “next” element in atable.
It returns True if the change was successful, otherwise False.
It also returns False if at least one index points outside atable,
but the last element in currind, that is allowed to be -1 to make it possible
to return pointers to the first element in atable.

Example: atable = [['a', 'b', 'c'], ['d'], ['e', 'f', 'g', 'h'], ['i', 'j']]
         currind = [2, 0, 1, 0], points to ['c', 'd', 'f', 'i'].
         getnext(atable, currind) returns True and currind becomes:
         currind == [2, 0, 1, 1] pointing to ['c', 'd', 'f', 'j'].
         If you call again getnext(atable, currind) it returns True and currind becomes:
         currind == [2, 0, 2, 0] pointing to ['c', 'd', 'g', 'i'].
         If currind were [2, 0, 3, 2], getnext(atable, currind) would return False.
         To print the whole atable in order:
         currind = [0 for _ in atable]
         currind[-1] = -1
         while getnext(atable, currind):
         print([atable[r][c] for r, c in enumerate(currind)])
"""