(1+x(1+2x))7=1+7x(1+2x)+21x2(1+2x)3+35x3(1+2x)4+... is as far as we need to go.
(1+2x)3=1+6x+12x2+8x3; (1+2x)4=1+8x+24x2+32x3+16x4.
So the expansion is:
1+7x+14x2+21x2(1+6x+12x2+8x3)+35x3(1+8x+24x2+32x3+16x4)+...
The terms in red take us beyond x3 so they can be ignored.
1+7x+14x2+21x2+126x3+35x3+...=1+7x+35x2+161x3