<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def next(self):
 """ Implementation of next method from Iterator. :return: Result :raises: StopIteration if IndexError occurs. """

        try:
            result = self.data[self.index]
        except IndexError:
            self.index = 0
            raise StopIteration
        self.index += 1
        return result