Retrieves information for a given image. Either a name or an image_id must be
    supplied.

    .. versionadded:: 2016.3.0

    name
        The name of the image for which to gather information. Can be used instead
        of ``image_id``.

    image_id
        The ID of the image for which to gather information. Can be used instead of
        ``name``.

    CLI Example:

    .. code-block:: bash

        salt-cloud -f image_info opennebula name=my-image
        salt-cloud --function image_info opennebula image_id=5

def image_info(call=None, kwargs=None):
    '''
    Retrieves information for a given image. Either a name or an image_id must be
    supplied.

    .. versionadded:: 2016.3.0

    name
        The name of the image for which to gather information. Can be used instead
        of ``image_id``.

    image_id
        The ID of the image for which to gather information. Can be used instead of
        ``name``.

    CLI Example:

    .. code-block:: bash

        salt-cloud -f image_info opennebula name=my-image
        salt-cloud --function image_info opennebula image_id=5
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The image_info function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    name = kwargs.get('name', None)
    image_id = kwargs.get('image_id', None)

    if image_id:
        if name:
            log.warning(
                'Both the \'image_id\' and \'name\' arguments were provided. '
                '\'image_id\' will take precedence.'
            )
    elif name:
        image_id = get_image_id(kwargs={'name': name})
    else:
        raise SaltCloudSystemExit(
            'The image_info function requires either a \'name or an \'image_id\' '
            'to be provided.'
        )

    server, user, password = _get_xml_rpc()
    auth = ':'.join([user, password])

    info = {}
    response = server.one.image.info(auth, int(image_id))[1]
    tree = _get_xml(response)
    info[tree.find('NAME').text] = _xml_to_dict(tree)

    return info