Python takewhile Iterator

Python takewhile(condition,data) iterator save data based on condition.

>>> from itertools import *
>>> data = [1,4,6,2,34,9]
>>> x = takewhile(lambda x: x<10,data) #drop after the elements >=10
>>> for i in x:
>>> print(i)
1
4
6
2