Show pricing for a particular profile. This is only an estimate, based on
    unofficial pricing sources.

    CLI Examples:

    .. code-block:: bash

        salt-cloud -f show_pricing my-ec2-config profile=my-profile

    If pricing sources have not been cached, they will be downloaded. Once they
    have been cached, they will not be updated automatically. To manually update
    all prices, use the following command:

    .. code-block:: bash

        salt-cloud -f update_pricing <provider>

    .. versionadded:: 2015.8.0

def show_pricing(kwargs=None, call=None):
    '''
    Show pricing for a particular profile. This is only an estimate, based on
    unofficial pricing sources.

    CLI Examples:

    .. code-block:: bash

        salt-cloud -f show_pricing my-ec2-config profile=my-profile

    If pricing sources have not been cached, they will be downloaded. Once they
    have been cached, they will not be updated automatically. To manually update
    all prices, use the following command:

    .. code-block:: bash

        salt-cloud -f update_pricing <provider>

    .. versionadded:: 2015.8.0
    '''
    profile = __opts__['profiles'].get(kwargs['profile'], {})
    if not profile:
        return {'Error': 'The requested profile was not found'}

    # Make sure the profile belongs to ec2
    provider = profile.get('provider', '0:0')
    comps = provider.split(':')
    if len(comps) < 2 or comps[1] != 'ec2':
        return {'Error': 'The requested profile does not belong to EC2'}

    image_id = profile.get('image', None)
    image_dict = show_image({'image': image_id}, 'function')
    image_info = image_dict[0]

    # Find out what platform it is
    if image_info.get('imageOwnerAlias', '') == 'amazon':
        if image_info.get('platform', '') == 'windows':
            image_description = image_info.get('description', '')
            if 'sql' in image_description.lower():
                if 'web' in image_description.lower():
                    name = 'mswinsqlweb'
                else:
                    name = 'mswinsql'
            else:
                name = 'mswin'
        elif image_info.get('imageLocation', '').strip().startswith('amazon/suse'):
            name = 'sles'
        else:
            name = 'linux'
    elif image_info.get('imageOwnerId', '') == '309956199498':
        name = 'rhel'
    else:
        name = 'linux'

    pricefile = os.path.join(
        __opts__['cachedir'], 'ec2-pricing-{0}.p'.format(name)
    )

    if not os.path.isfile(pricefile):
        update_pricing({'type': name}, 'function')

    with salt.utils.files.fopen(pricefile, 'r') as fhi:
        ec2_price = salt.utils.stringutils.to_unicode(
            salt.utils.msgpack.load(fhi))

    region = get_location(profile)
    size = profile.get('size', None)
    if size is None:
        return {'Error': 'The requested profile does not contain a size'}

    try:
        raw = ec2_price[region][size]
    except KeyError:
        return {'Error': 'The size ({0}) in the requested profile does not have '
                'a price associated with it for the {1} region'.format(size, region)}

    ret = {}
    if kwargs.get('raw', False):
        ret['_raw'] = raw

    ret['per_hour'] = 0
    for col in raw.get('valueColumns', []):
        ret['per_hour'] += decimal.Decimal(col['prices'].get('USD', 0))

    ret['per_hour'] = decimal.Decimal(ret['per_hour'])
    ret['per_day'] = ret['per_hour'] * 24
    ret['per_week'] = ret['per_day'] * 7
    ret['per_month'] = ret['per_day'] * 30
    ret['per_year'] = ret['per_week'] * 52

    return {profile['profile']: ret}