def handle_event(self, event):
    if isinstance(event, CardPlayedEvent):
        self.card_played(event.player, event.card, event.game_state)
    elif isinstance(event, MessageEvent):
        self.send_message(event.sender, event.message)
    elif isinstance(event, TrickPlayedEvent):
        self.trick_played(event.player, event.game_state)
    elif isinstance(event, TurnEvent):
        self.game_state.update(event.game_state)
        state = self.controller.get_state(self.id)
        self.hand = state['hand']
        self.game_state.update(state['game_state'])
    elif isinstance(event, StateChangedEvent):
        self.game_state.update(event.game_state)
    else:
        print(('unknown event: %s' % event))
def handle_event(self, event):
    if isinstance(event, CardPlayedEvent):
        self.card_played(event.player, event.card, event.game_state)
    elif isinstance(event, MessageEvent):
        self.send_message(event.sender, event.message)
    elif isinstance(event, TrickPlayedEvent):
        self.trick_played(event.player, event.game_state)
    elif isinstance(event, TurnEvent):
        self.game_state.update(event.game_state)
        state = self.controller.get_state(self.id)
        self.hand = state['hand']
        self.game_state.update(state['game_state'])
    elif isinstance(event, StateChangedEvent):
        self.game_state.update(event.game_state)
    else:
        print(('unknown event: %s' % event))