filter out search results with bad season and episode number (if
    applicable); sometimes OpenSubtitles will report search results subtitles
    that belong to a different episode or season from a tv show; no reason
    why, but it seems to work well just filtering those out

def filter_bad_results(search_results, guessit_query):
    """
    filter out search results with bad season and episode number (if
    applicable); sometimes OpenSubtitles will report search results subtitles
    that belong to a different episode or season from a tv show; no reason
    why, but it seems to work well just filtering those out
    """
    if 'season' in guessit_query and 'episode' in guessit_query:
        guessit_season_episode = (guessit_query['season'], guessit_query['episode'])
        search_results = [x for x in search_results
                          if (int(x['SeriesSeason']), int(x['SeriesEpisode'])) == guessit_season_episode]
    return search_results