def next(self):
if self.limit and self.limit == self.num_tweets:<EOL><INDENT>raise StopIteration<EOL><DEDENT>if self.index >= len(self.results) - <NUM_LIT:1>:<EOL><INDENT>data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs)<EOL>if hasattr(self.method, '<STR_LIT>'):<EOL><INDENT>old_parser = self.method.__self__.parser<EOL>self.method.__self__.parser = ModelParser()<EOL><DEDENT>model = ModelParser().parse(self.method(create=True), data)<EOL>if hasattr(self.method, '<STR_LIT>'):<EOL><INDENT>self.method.__self__.parser = old_parser<EOL>result = self.method.__self__.parser.parse(self.method(create=True), data)<EOL><DEDENT>else:<EOL><INDENT>result = model<EOL><DEDENT>if len(self.results) != <NUM_LIT:0>:<EOL><INDENT>self.index += <NUM_LIT:1><EOL><DEDENT>self.results.append(result)<EOL>self.model_results.append(model)<EOL><DEDENT>else:<EOL><INDENT>self.index += <NUM_LIT:1><EOL>result = self.results[self.index]<EOL>model = self.model_results[self.index]<EOL><DEDENT>if len(result) == <NUM_LIT:0>:<EOL><INDENT>raise StopIteration<EOL><DEDENT>self.max_id = model.max_id<EOL>self.num_tweets += <NUM_LIT:1><EOL>return result<EOL>
Fetch a set of items with IDs less than current set.