def _get_episode_thumb_url(ep_obj):
        # type: (sickbeard.tv.TVEpisode) -> Optional[AnyStr]
        """
        Returns the URL to use for downloading an episode's thumbnail. Uses
        theTVDB.com and TVRage.com data.

        :param ep_obj: a TVEpisode object for which to grab the thumb URL
        :return: URL to thumb
        """

        ep_obj_list = [ep_obj] + ep_obj.related_ep_obj

        # validate show
        from .. import helpers
        if not helpers.validate_show(ep_obj.show_obj):
            return None

        # try all included episodes in case some have thumbs and others don't
        for cur_ep_obj in ep_obj_list:
            if TVINFO_TVDB == cur_ep_obj.show_obj.tvid:
                show_lang = cur_ep_obj.show_obj.lang

                try:
                    tvinfo_config = sickbeard.TVInfoAPI(TVINFO_TVDB).api_params.copy()
                    tvinfo_config['dvdorder'] = 0 != cur_ep_obj.show_obj.dvdorder
                    tvinfo_config['no_dummy'] = True

                    if show_lang and not 'en' == show_lang:
                        tvinfo_config['language'] = show_lang

                    t = sickbeard.TVInfoAPI(TVINFO_TVDB).setup(**tvinfo_config)

                    ep_info = t[cur_ep_obj.show_obj.prodid][cur_ep_obj.season][cur_ep_obj.episode]
                except (BaseTVinfoEpisodenotfound, BaseTVinfoSeasonnotfound, TypeError):
                    ep_info = None
            else:
                ep_info = helpers.validate_show(cur_ep_obj.show_obj, cur_ep_obj.season, cur_ep_obj.episode)

            if not ep_info:
                continue

            thumb_url = getattr(ep_info, 'filename', None) \
                or (isinstance(ep_info, dict) and ep_info.get('filename', None))
            if thumb_url not in (None, False, ''):
                return thumb_url

        return None