code: def connect(self, *, network=None, from_backup=None):
          
          if network and from_backup:
              raise WrongParameter("Please provide network OR from_backup")
  
          elif network:
              self.properties.network = network
              try:
                  name = self.properties.network.read(
                      "{} device {} objectName".format(
                          self.properties.address, self.properties.device_id
                      )
                  )
  
                  segmentation = self.properties.network.read(
                      "{} device {} segmentationSupported".format(
                          self.properties.address, self.properties.device_id
                      )
                  )
  
                  if not self.segmentation_supported or segmentation not in (
                      "segmentedTransmit",
                      "segmentedBoth",
                  ):
                      segmentation_supported = False
                      self._log.debug("Segmentation not supported")
                  else:
                      segmentation_supported = True
  
                  if name:
                      if segmentation_supported:
                          self.new_state(RPMDeviceConnected)
                      else:
                          self.new_state(RPDeviceConnected)
                      # self.db.close()
  
              except NoResponseFromController:
                  self._log.error("Unable to connect, keeping DB mode active")
  
          elif from_backup:
              self.properties.db_name = from_backup.split(".")[0]
              self._init_state()
docs: In DBState, a device can be reconnected to BACnet using:
              device.connect(network=bacnet) (bacnet = BAC0.connect())