<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_outcome(self, name, outcome_id=None):
 """Add a new outcome to the state :param str name: the name of the outcome to add :param int outcome_id: the optional outcome_id of the new outcome :return: outcome_id: the outcome if of the generated state :rtype: int """

        if outcome_id is None:
            outcome_id = generate_outcome_id(list(self.outcomes.keys()))
        if name in self._outcomes:
            logger.error("Two outcomes cannot have the same names")
            return
        if outcome_id in self.outcomes:
            logger.error("Two outcomes cannot have the same outcome_ids")
            return
        outcome = Outcome(outcome_id, name, self)
        self._outcomes[outcome_id] = outcome
        return outcome_id