def format_object(self, obj):
        """Takes the given object and returns a formatted string representing the object."""
        if isinstance(obj, BluetoothDevice):
            # status.value is 0 for connected, 1 for paired (and unconnected), 2 for unpaired
            symbol = self.symbols[obj.status.value]
            if obj.battery:
                battery_level = self.device_battery_format.format(battery=obj.battery)
            else:
                battery_level = ""
            return self.device_format.format(
                symbol=symbol, name=obj.name, adapter=obj.adapter, battery_level=battery_level
            )

        elif isinstance(obj, BluetoothAdapter):
            powered = 0 if obj.powered else 1
            discovery = 0 if obj.discovering else 1
            return self.adapter_format.format(
                powered=self.symbol_powered[powered],
                discovery=self.symbol_discovery[discovery],
                name=obj.name,
            )

        elif isinstance(obj, str):
            return obj

        # Shouldn't happen but let's be safe!
        return ""
Takes the given object and returns a formatted string representing the object.
libqtile/widget/bluetooth.py