Adding missing itertools import

'takewhile' and 'dropwhile' were raising errors because of the missing import statement