Ensure cache subnet group exists.

    name
        A name for the cache subnet group. This value is stored as a lowercase string.
        Constraints:  Must contain no more than 255 alphanumeric characters or hyphens.

    subnets
        A list of VPC subnets (IDs, Names, or a mix) for the cache subnet group.

    CacheSubnetGroupName
        A name for the cache subnet group. This value is stored as a lowercase string.
        Constraints:  Must contain no more than 255 alphanumeric characters or hyphens.
        Note:  In general this parameter is not needed, as 'name' is used if it's not provided.

    CacheSubnetGroupDescription
        A description for the cache subnet group.

    SubnetIds
        A list of VPC subnet IDs for the cache subnet group.  This is ADDITIVE with 'subnets' above.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.

def cache_subnet_group_present(name, subnets=None, region=None, key=None, keyid=None, profile=None,
                               **args):
    '''
    Ensure cache subnet group exists.

    name
        A name for the cache subnet group. This value is stored as a lowercase string.
        Constraints:  Must contain no more than 255 alphanumeric characters or hyphens.

    subnets
        A list of VPC subnets (IDs, Names, or a mix) for the cache subnet group.

    CacheSubnetGroupName
        A name for the cache subnet group. This value is stored as a lowercase string.
        Constraints:  Must contain no more than 255 alphanumeric characters or hyphens.
        Note:  In general this parameter is not needed, as 'name' is used if it's not provided.

    CacheSubnetGroupDescription
        A description for the cache subnet group.

    SubnetIds
        A list of VPC subnet IDs for the cache subnet group.  This is ADDITIVE with 'subnets' above.

    region
        Region to connect to.

    key
        Secret key to be used.

    keyid
        Access key to be used.

    profile
        A dict with region, key and keyid, or a pillar key (string) that
        contains a dict with region, key and keyid.
    '''
    ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
    args = dict([(k, v) for k, v in args.items() if not k.startswith('_')])
    current = __salt__['boto3_elasticache.'
                       'describe_cache_subnet_groups'](name, region=region, key=key,
                                                       keyid=keyid, profile=profile)
    if current:
        check_update = True
    else:
        check_update = False
        if __opts__['test']:
            ret['comment'] = 'Cache subnet group {0} would be created.'.format(name)
            ret['result'] = None
            return ret
        created = __salt__['boto3_elasticache.'
                           'create_cache_subnet_group'](name, subnets=subnets,
                                                        region=region, key=key, keyid=keyid,
                                                        profile=profile, **args)
        if created:
            new = __salt__['boto3_elasticache.'
                           'describe_cache_subnet_groups'](name, region=region, key=key,
                                                           keyid=keyid, profile=profile)
            ret['comment'] = 'Cache subnet group {0} was created.'.format(name)
            ret['changes']['old'] = None
            ret['changes']['new'] = new[0]
        else:
            ret['result'] = False
            ret['comment'] = 'Failed to create {0} cache subnet group.'.format(name)

    if check_update:
        need_update = _diff_cache_subnet_group(current, args)
        if need_update:
            if __opts__['test']:
                ret['comment'] = 'Cache subnet group {0} would be modified.'.format(name)
                ret['result'] = None
                return ret
            modified = __salt__['boto3_elasticache.'
                                'modify_cache_subnet_group'](name, subnets=subnets,
                                                             region=region, key=key, keyid=keyid,
                                                             profile=profile, **need_update)
            if modified:
                new = __salt__['boto3_elasticache.'
                               'describe_cache_subnet_groups'](name, region=region, key=key,
                                                               keyid=keyid, profile=profile)
                ret['comment'] = 'Cache subnet group {0} was modified.'.format(name)
                ret['changes']['old'] = current['CacheSubetGroups'][0]
                ret['changes']['new'] = new[0]
            else:
                ret['result'] = False
                ret['comment'] = 'Failed to modify cache subnet group {0}.'.format(name)
        else:
            ret['comment'] = 'Cache subnet group {0} is in the desired state.'.format(name)
    return ret