def create_subnet_group(name, description, subnet_ids=None, subnet_names=None, tags=None,
                        region=None, key=None, keyid=None, profile=None):
    '''
    Create an ElastiCache subnet group

    CLI example to create an ElastiCache subnet group::

        salt myminion boto_elasticache.create_subnet_group my-subnet-group \
            "group description" subnet_ids='[subnet-12345678, subnet-87654321]' \
            region=us-east-1
    '''
    if not _exactly_one((subnet_ids, subnet_names)):
        raise SaltInvocationError("Exactly one of either 'subnet_ids' or "
                                  "'subnet_names' must be provided.")
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    if not conn:
        return False
    if subnet_group_exists(name, tags, region, key, keyid, profile):
        return True
    if subnet_names:
        subnet_ids = []
        for n in subnet_names:
            r = __salt__['boto_vpc.get_resource_id']('subnet', n,
                                                     region=region, key=key,
                                                     keyid=keyid, profile=profile)
            if 'id' not in r:
                log.error('Couldn\'t resolve subnet name %s to an ID.', subnet_name)
                return False
            subnet_ids += [r['id']]
    try:
        ec = conn.create_cache_subnet_group(name, description, subnet_ids)
        if not ec:
            msg = 'Failed to create ElastiCache subnet group {0}'.format(name)
            log.error(msg)
            return False
        log.info('Created ElastiCache subnet group %s', name)
        return True
    except boto.exception.BotoServerError as e:
        log.debug(e)
        msg = 'Failed to create ElastiCache subnet group {0}'.format(name)
        log.error(msg)
        return False