def show_line(self):
        """Formats the text of the current menu item."""
        if not self._lines:
            return

        obj = None

        # If devices disappear we may have an invalid line index
        while obj is None:
            try:
                obj, action = self._lines[self._line_index]
            except IndexError:
                self._line_index -= 1

        self.update(self.format_object(obj))
Formats the text of the current menu item.
libqtile/widget/bluetooth.py