code: def _device_expiry_callback(self):
          
  
          expired = 0
          for adapters in self._devices.values():
              to_remove = []
              now = monotonic()
  
              for adapter_id, dev in adapters.items():
                  if 'expires' not in dev:
                      continue
  
                  if now > dev['expires']:
                      to_remove.append(adapter_id)
                      local_conn = "adapter/%d/%s" % (adapter_id, dev['connection_string'])
  
                      if local_conn in self._conn_strings:
                          del self._conn_strings[local_conn]
  
              for entry in to_remove:
                  del adapters[entry]
                  expired += 1
  
          if expired > 0:
              self._logger.info('Expired %d devices', expired)
docs: Periodic callback to remove expired devices from visible_devices.