def _interface_added(self, path, interfaces):
        """Handles the object based on the interface type."""
        task = None

        # Create device or adapter
        for device_type in (BLUEZ_DEVICE, BLUEZ_ADAPTER):
            if device_type in interfaces:
                task = create_task(self._add_object(path, device_type))
                break

        if task is not None and not self._setting_up:
            task.add_done_callback(lambda *args: self.refresh())

        # Battery interface is added after the device is connected
        # so no task will have been created at this point.
        if not task and BLUEZ_BATTERY in interfaces:
            if device := self.devices.get(path):
                # Get device to load battery interface
                device.add_battery()
Handles the object based on the interface type.
libqtile/widget/bluetooth.py