def METHOD_NAME(self, message):
    """Sets an entry in the aggregate by result.
    For messages that include a "result" key, expected for example,
    from a "finished" status message, this will allow users to query
    for tasks with a given result."""
    result = message.get("result")
    if result not in self._by_result:
        self._by_result[result] = []
    if message["id"] not in self._by_result[result]:
        self._by_result[result].append(message["id"])