<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def modify_target(self, to_state, to_outcome=None):
 """Set both to_state and to_outcome at the same time to modify transition target :param str to_state: State id of the target state :param int to_outcome: Outcome id of the target port :raises exceptions.ValueError: If parameters have wrong types or the new transition is not valid """

        if not (to_state is None and (to_outcome is not int and to_outcome is not None)):
            if not isinstance(to_state, string_types):
                raise ValueError("Invalid transition target port: to_state must be a string")
            if not isinstance(to_outcome, int) and to_outcome is not None:
                raise ValueError("Invalid transition target port: to_outcome must be of type int or None (if to_state "
                                 "is of type str)")

        old_to_state = self.to_state
        old_to_outcome = self.to_outcome
        self._to_state = to_state
        self._to_outcome = to_outcome

        valid, message = self._check_validity()
        if not valid:
            self._to_state = old_to_state
            self._to_outcome = old_to_outcome
            raise ValueError("The transition target could not be changed: {0}".format(message))