Return the image object to use

def get_image(vm_):
    '''
    Return the image object to use
    '''
    vm_image = config.get_cloud_config_value('image', vm_, __opts__).encode(
        'ascii', 'salt-cloud-force-ascii'
    )

    images = avail_images()
    for key, value in six.iteritems(images):
        if vm_image and vm_image in (images[key]['id'], images[key]['name']):
            return images[key]

    raise SaltCloudNotFound(
        'The specified image, \'{0}\', could not be found.'.format(vm_image)
    )