def sortResultsByRes(fetched_urls): prefereResSetting = utils.parse_resolution_of_source(control.getSetting('prefres')) filtered_urls = filter(lambda x: utils.parse_resolution_of_source(x[0]) <= prefereResSetting, fetched_urls) return sorted(filtered_urls, key=lambda x: utils.parse_resolution_of_source(x[0]), reverse=True)