'Get the setting named key. First looks for a device specific setting.
If that is not found looks for a device default and if that is not
found uses the global default.'

def get_pref(self, key):

    dd = (self.current_device_defaults if self.is_mtp_device_connected else {})
    dev_settings = self.prefs.get((u'device-%s' % self.current_serial_num), {})
    default_value = dd.get(key, self.prefs[key])
    return dev_settings.get(key, default_value)
