def _get_game_to_notify(connection, notification):
    """ Get notified game from connection using notification parameters.

        :param connection: connection that receives the notification.
        :param notification: notification received.
        :return: a NetworkGame instance, or None if no game found.
        :type connection: diplomacy.Connection
        :type notification: diplomacy.communication.notifications._GameNotification
    """
    channel = connection.channels.get(notification.token, None)
    if channel and notification.game_id in channel.game_id_to_instances:
        return channel.game_id_to_instances[notification.game_id].get(
            notification.game_role)
    return None
