<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def operations(self, op_types=None):
 """Process operation stream."""

        if not op_types:
            op_types = ['message', 'action', 'sync', 'viewlock', 'savedchapter']
        while self._handle.tell() < self._eof:
            current_time = mgz.util.convert_to_timestamp(self._time / 1000)
            try:
                operation = mgz.body.operation.parse_stream(self._handle)
            except (ConstructError, ValueError):
                raise MgzError('failed to parse body operation')
            if operation.type == 'action':
                if operation.action.type in ACTIONS_WITH_PLAYER_ID:
                    counter = self._actions_by_player[operation.action.player_id]
                    counter.update([operation.action.type])
                else:
                    self._actions_without_player.update([operation.action.type])
            if operation.type == 'action' and isinstance(operation.action.type, int):
                print(operation.action)
            if operation.type == 'sync':
                self._time += operation.time_increment
            if operation.type == 'action' and operation.action.type == 'postgame':
                self._postgame = operation
            if operation.type == 'action':
                action = Action(operation, current_time)
                self._parse_action(action, current_time)
            if operation.type == 'savedchapter':
                # fix: Don't load messages we already saw in header or prev saved chapters
                self._parse_lobby_chat(operation.lobby.messages, 'save', current_time)
            if operation.type == 'viewlock':
                if operation.type in op_types:
                    yield Viewlock(operation)
            elif operation.type == 'action' and operation.action.type != 'postgame':
                if operation.type in op_types:
                    yield Action(operation, current_time)
            elif ((operation.type == 'message' or operation.type == 'embedded')
                  and operation.subtype == 'chat'):
                chat = ChatMessage(operation.data.text, current_time,
                                   self._players(), self._diplomacy['type'], 'game')
                self._parse_chat(chat)
                if operation.type in op_types:
                    yield chat