use itertools instead of flatten in lambd*