def flatten(lst):
def flatten_aux(item, accumulated):<EOL><INDENT>if type(item) != list:<EOL><INDENT>accumulated.append(item)<EOL><DEDENT>else:<EOL><INDENT>for l in item:<EOL><INDENT>flatten_aux(l, accumulated)<EOL><DEDENT><DEDENT><DEDENT>accumulated = []<EOL>flatten_aux(lst,accumulated)<EOL>return accumulated<EOL>
flatten([["a","btr"],"b", [],["c",["d",["e"], []]]]) will return ['a', 'btr', 'b', 'c', 'd', 'e']