<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def outcomes(self, outcomes):
 """ Setter for _outcomes field See property. :param dict outcomes: Dictionary outcomes[outcome_id] that maps :class:`int` outcome_ids onto values of type :class:`rafcon.core.state_elements.logical_port.Outcome` :raises exceptions.TypeError: if outcomes parameter has the wrong type :raises exceptions.AttributeError: if the key of the outcome dictionary and the id of the outcome do not match """

        if not isinstance(outcomes, dict):
            raise TypeError("outcomes must be of type dict")
        if [outcome_id for outcome_id, outcome in outcomes.items() if not isinstance(outcome, Outcome)]:
            raise TypeError("element of outcomes must be of type Outcome")
        if [outcome_id for outcome_id, outcome in outcomes.items() if not outcome_id == outcome.outcome_id]:
            raise AttributeError("The key of the outcomes dictionary and the id of the outcome do not match")

        old_outcomes = self.outcomes
        self._outcomes = outcomes
        for outcome_id, outcome in outcomes.items():
            try:
                outcome.parent = self
            except ValueError:
                self._outcomes = old_outcomes
                raise

        # aborted and preempted must always exist
        if -1 not in outcomes:
            self._outcomes[-1] = Outcome(outcome_id=-1, name="aborted", parent=self)
        if -2 not in outcomes:
            self._outcomes[-2] = Outcome(outcome_id=-2, name="preempted", parent=self)

        # check that all old_outcomes are no more referencing self as there parent
        for old_outcome in old_outcomes.values():
            if old_outcome not in iter(list(self._outcomes.values())) and old_outcome.parent is self:
                old_outcome.parent = None