def transition(self, duration, is_on=None, **kwargs):
self._cancel_active_transition()<EOL>dest_state = self._prepare_transition(is_on, **kwargs)<EOL>total_steps = self._transition_steps(**dest_state)<EOL>state_stages = [self._transition_stage(step, total_steps, **dest_state)<EOL>for step in range(total_steps)]<EOL>pwm_stages = [self._get_pwm_values(**stage)<EOL>for stage in state_stages]<EOL>callback = partial(self._transition_callback, is_on)<EOL>self._active_transition = Transition(self._driver, duration,<EOL>state_stages, pwm_stages,<EOL>callback)<EOL>TransitionManager().execute(self._active_transition)<EOL>return self._active_transition<EOL>
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.