'Gets an image URL from theTVDB.com and fanart.tv, downloads it and returns the data.
image_type: type of image to retrieve (currently supported: fanart, poster, banner)
show_obj: a TVShow object to use when searching for the image
which: optional, a specific numbered poster to look for
Returns: the binary image data if available, or else None'

def _retrieve_show_image(self, image_type, show_obj, which=0):

    image_data = None
    indexer_lang = (show_obj.lang or sickrage.srCore.srConfig.INDEXER_DEFAULT_LANGUAGE)
    try:
        lINDEXER_API_PARMS = srIndexerApi(show_obj.indexer).api_params.copy()
        lINDEXER_API_PARMS[u'language'] = indexer_lang
        if (show_obj.dvdorder != 0):
            lINDEXER_API_PARMS[u'dvdorder'] = True
        t = srIndexerApi(show_obj.indexer).indexer(**lINDEXER_API_PARMS)
        indexer_show_obj = t[show_obj.indexerid]
    except (indexer_error, IOError) as e:
        sickrage.srCore.srLogger.warning(((u'{}:    Unable    to    look    up    show    on    '.format(show_obj.indexerid) + srIndexerApi(show_obj.indexer).name) + u',    not    downloading    images:    {}'.format(e.message)))
        sickrage.srCore.srLogger.debug(((u'Indexer    ' + srIndexerApi(show_obj.indexer).name) + u'    maybe    experiencing    some    problems.    Try    again    later'))
        return None
    if (image_type not in (u'fanart', u'poster', u'series', u'poster_thumb', u'series_thumb')):
        sickrage.srCore.srLogger.error(((((u'Invalid    image    type    ' + str(image_type)) + u",    couldn't    find    it    in    the    ") + srIndexerApi(show_obj.indexer).name) + u'    object'))
        return
    if (image_type == u'poster_thumb'):
        try:
            image_url = indexer_show_obj[u'_images'][u'poster'][u'thumbnail'][which]
        except KeyError:
            image_url = self._retrieve_show_images_from_fanart(show_obj, image_type)
    elif (image_type == u'series_thumb'):
        try:
            image_url = indexer_show_obj[u'_images'][u'series'][u'thumbnail'][which]
        except KeyError:
            image_url = self._retrieve_show_images_from_fanart(show_obj, image_type)
    else:
        try:
            image_url = indexer_show_obj[u'_images'][image_type][u'filename'][which]
        except KeyError:
            image_url = self._retrieve_show_images_from_fanart(show_obj, image_type)
    if image_url:
        image_data = getShowImage(image_url)
    return image_data
