def _catch_dbus_error(msg):
    """Decorator to catch DBusErrors and log a message."""

    def _wrapper(func):
        async def f(self):
            try:
                await func(self)
            except DBusError:
                logger.warning(msg, self.name)

        return f

    return _wrapper
Decorator to catch DBusErrors and log a message.
libqtile/widget/bluetooth.py