def _get_random_image(term):
    '''
        Get Random Image

        Get a random image from Imgur

        --
        @param term:str

        @return str
    '''
    data = _ask_imgur(search_api.format(
        term = term.encode('utf-8')))

    if data not in 'data' or len(data['data']) <= 0:
        return 'Imgur query had no results'

    # Results from the search may contain image data
    # models or gallery data models. Filter the
    # choices we make by ones that are not albums
    is_album = True
    while is_album:

        # Try and filter out images that are marked as
        # nsfw if the config is set for that.
        if _allow_nsfw():
            image_data = random.choice(data['data'])
        else:
            nsfw = True
            while nsfw:
                image_data = random.choice(data['data'])
                if not image_data['nsfw']:
                    nsfw = False

        if not image_data['is_album']:
            is_album = False

    response = ("\nTitle: {title}\n"
                "Link: {link}")

    return response.format(
        title = image_data['title'], link = image_data['link'])
dataset/ETHPy150Open leonjza/hogar/hogar/Plugins/Imgur/main.py/_get_random_image/swapped operands of `not in`