def flatten(items): out = [] for i in items: if type(i) == type([]): for j in i: if type(j) == type([]): for k in j: out.append(k) else: out.append(j) else: out.append(i) return out