<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def transition(self, duration, is_on=None, **kwargs):
 """ Transition to the specified state of the led. If another transition is already running, it is aborted. :param duration: The duration of the transition. :param is_on: The on-off state to transition to. :param kwargs: The state to transition to. """

        self._cancel_active_transition()

        dest_state = self._prepare_transition(is_on, **kwargs)
        total_steps = self._transition_steps(**dest_state)
        state_stages = [self._transition_stage(step, total_steps, **dest_state)
                        for step in range(total_steps)]
        pwm_stages = [self._get_pwm_values(**stage)
                      for stage in state_stages]
        callback = partial(self._transition_callback, is_on)
        self._active_transition = Transition(self._driver, duration,
                                             state_stages, pwm_stages,
                                             callback)

        TransitionManager().execute(self._active_transition)

        return self._active_transition