code: def active_time(self):
          
          if self._active_event.is_set():
              return self.pin_factory.ticks_diff(self.pin_factory.ticks(),
                                                 self._last_changed)
          else:
              return None
docs: The length of time (in seconds) that the device has been active for.
          When the device is inactive, this is :data:`None`.