Transition.

        :param duration: Time to transition.
        :param hue: Transition to this hue.
        :param brightness: Transition to this brightness.

def _transition(self, duration, hue=None, brightness=None):
        """ Transition.

        :param duration: Time to transition.
        :param hue: Transition to this hue.
        :param brightness: Transition to this brightness.
        """
        # Calculate brightness steps.
        b_steps = 0
        if brightness is not None:
            b_steps = steps(self.brightness,
                            brightness, self.command_set.brightness_steps)
            b_start = self.brightness
        # Calculate hue steps.
        h_steps = 0
        if hue is not None:
            h_steps = steps(self.hue,
                            hue, self.command_set.hue_steps)
            h_start = self.hue
        # Compute ideal step amount (at least one).
        total_steps = max(b_steps, h_steps, 1)
        total_commands = b_steps + h_steps
        # Calculate wait.
        wait = self._wait(duration, total_steps, total_commands)
        # Scale down steps if no wait time.
        if wait == 0:
            b_steps, h_steps = self._scale_steps(duration, total_commands,
                                                 b_steps, h_steps)
            total_steps = max(b_steps, h_steps, 1)
        # Perform transition.
        for i in range(total_steps):
            # Brightness.
            if b_steps > 0 and i % math.ceil(total_steps/b_steps) == 0:
                self.brightness = util.transition(i, total_steps,
                                                  b_start, brightness)
            # Hue.
            if h_steps > 0 and i % math.ceil(total_steps/h_steps) == 0:
                self.hue = util.transition(i, total_steps,
                                           h_start, hue)
            # Wait.
            time.sleep(wait)