def get_deepest_list(lst, depth=0):
    deepest_list = lst
max_depth = depth
for li in lst:
    if type(li) == list:
        tmp_deepest_list, tmp_max_depth = get_deepest_list(li, depth + 1)
if max_depth < tmp_max_depth:
    max_depth = tmp_max_depth
deepest_list = tmp_deepest_list
return deepest_list, max_depth
Python: add a value to the end of the inner-most right nested list