<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def for_each(self, operation, limit=0, verbose=False):
 """ Applies the given Operation to each item in the stream. The Operation executes on the items in the stream in the order that they appear in the stream. If the limit is supplied, then processing of the stream will stop after that many items have been processed. """

        if limit != 0:
            count = 0
            while self.has_next():
                operation.perform(self.next())
                count += 1
                if verbose:
                    print count
                if count >= limit:
                    break
        else:
            while self.has_next():
                operation.perform(self.next())