def ensure_connected(f):
        """Tries to connect to the player

        It *should* be successful if the player is alive
        """
        def wrapper(*args, **kwargs):
            self = args[0]
            try:
                self.iface.GetMetadata()
            except (dbus.exceptions.DBusException, __HOLE__):
                # except AttributeError because
                # self.iface won't exist if we haven't
                # _connect()ed yet
                self._connect()
            return f(*args, **kwargs)
        return wrapper
dataset/ETHPy150Open qtile/qtile/libqtile/widget/mpriswidget.py/Mpris.ensure_connected