<s> import six <EOL> class DataIterator ( six . Iterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data_stream , request_iterator = None , as_dict = False ) : <EOL> self . data_stream = data_stream <EOL> self . request_iterator = request_iterator <EOL> self . as_dict = as_dict <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def __next__ ( self ) : <EOL> if self . request_iterator is not None : <EOL> data = self . data_stream . get_data ( next ( self . request_iterator ) ) <EOL> else : <EOL> data = self . data_stream . get_data ( ) <EOL> if self . as_dict : <EOL> return dict ( zip ( self . data_stream . sources , data ) ) <EOL> else : <EOL> return data </s>
