code: def toggle(self):
          
          with self._lock:
              if self.is_active:
                  self.off()
              else:
                  self.on()
docs: Reverse the state of the device. If it's on, turn it off; if it's off,
          turn it on.