Perform pre-transition tasks and construct the destination state.

        :param is_on: The on-off state to transition to.
        :param kwargs: The state to transition to.
        :return: The destination state of the transition.

def _prepare_transition(self, is_on=None, **kwargs):
        """
        Perform pre-transition tasks and construct the destination state.

        :param is_on: The on-off state to transition to.
        :param kwargs: The state to transition to.
        :return: The destination state of the transition.
        """
        # Handle transitions with changing on-off-state
        dest_state = kwargs.copy()
        if is_on is not None:
            if is_on and not self.is_on:
                if 'brightness' not in kwargs or kwargs['brightness'] is None:
                    dest_state['brightness'] = self.brightness
                self.set(brightness=0, cancel_transition=False)
            elif not is_on and self.is_on:
                dest_state['brightness'] = 0

        return dest_state