Getitem error

Wrote this code to take in two parallel lists/trees such that

x = [1,2,1]

and

y = [[p1,p2,p3,p4,p5,p6],[pt1,pt2,pt3,pt4,pt5,pt6], [pn1,pn2,pn3,pn4,pn5,pn6]]

after placing through the data tree to list converter, but when I run my code, I receive the error:

Runtime error (ArgumentTypeException): getitem() takes exactly 2 arguments (1 given)

Traceback:
line 32, in script

def tree_to_list(input, retrieve_base = lambda x: x[0]):
    """Returns a list representation of a Grasshopper DataTree"""
    def extend_at(path, index, simple_input, rest_list):
        target = path[index]
        if len(rest_list) <= target: rest_list.extend([None]*(target-len(rest_list)+1))
        if index == path.Length - 1:
            rest_list[target] = list(simple_input)
        else:
            if rest_list[target] is None: rest_list[target] = []
            extend_at(path, index+1, simple_input, rest_list[target])
    all = []
    for i in range(input.BranchCount):
        path = input.Path(i)
        extend_at(path, 0, input.Branch(path), all)
    return retrieve_base(all)
    
pts = tree_to_list(y)
ptList = []
for i, numb in enumerate(x):
    if numb == 1:
        ptList.append(y[i][0])
    elif numb == 2:
        ptList.append(y[i][-1])
``

Hello,

Which is line 32? Is there some more text in the traceback?

Graham