def clean_up(alist, list_threshold):
return list(filter(lambda e:len(e[1])<=list_threshold, alist))
L = [["medium", [9, 3]], ["long", [1, 2, 3, 4]], ["short", [8]]]
result = clean_up(L, 2)
print(result)
print('same_alist(result,'+repr(result)+')')
============
[['medium', [9, 3]], ['short', [8]]]
same_alist(result,[['medium', [9, 3]], ['short', [8]]])