def select_format(self, format_spec, available_formats):
        if format_spec == 'best' or format_spec is None:
            return available_formats[-1]
        elif format_spec == 'worst':
            return available_formats[0]
        elif format_spec == 'bestaudio':
            audio_formats = [
                f for f in available_formats
                if f.get('vcodec') == 'none']
            if audio_formats:
                return audio_formats[-1]
        elif format_spec == 'worstaudio':
            audio_formats = [
                f for f in available_formats
                if f.get('vcodec') == 'none']
            if audio_formats:
                return audio_formats[0]
        elif format_spec == 'bestvideo':
            video_formats = [
                f for f in available_formats
                if f.get('acodec') == 'none']
            if video_formats:
                return video_formats[-1]
        elif format_spec == 'worstvideo':
            video_formats = [
                f for f in available_formats
                if f.get('acodec') == 'none']
            if video_formats:
                return video_formats[0]
        else:
            extensions = ['mp4', 'flv', 'webm', '3gp', 'm4a', 'mp3', 'ogg', 'aac', 'wav']
            if extensions in format_spec:
                filter_f = lambda f: f['ext'] == format_spec
            else:
                filter_f = lambda f: f['format_id'] == format_spec
            matches = list(filter(filter_f, available_formats))
            if matches:
                return matches[-1]
        return None
dataset/ETHPy150Open yasoob/youtube-dl-GUI/youtube_dl/YoutubeDL.py/YoutubeDL.select_format/swapped operands of `in`