code: def transition(self, duration, color=None, brightness=None):
          
          # Transition to white immediately.
          if color == RGB_WHITE:
              self.white()
              color = None
          # Transition away from white immediately.
          elif self.color == RGB_WHITE and color is not None:
              self.color = color
              color = None
          # Transition immediately if duration is zero.
          if duration == 0:
              if color:
                  self.color = color
              if brightness is not None:
                  self.brightness = brightness
              return
          # Perform transition
          if color != self.color or brightness != self.brightness:
              if color is None and brightness == self.brightness:
                  return
              if color is None:
                  self._transition(duration, brightness=brightness)
              else:
                  self._transition(duration, hue_of_color(color), brightness)
docs: Transition wrapper.
  
          Short-circuit transition as necessary.
  
          :param duration: Time to transition.
          :param color: Transition to this color.
          :param brightness: Transition to this brightness.