human
Complete this python program:
def _get_base(**kwargs):
assistant
#Here is the Python program you requested.

    """If the needed base does not exist, then create it, if it does exist
    create nothing and return the name of the base lxc container so
    it can be cloned.
    """
    profile = get_container_profile(copy.deepcopy(kwargs.get('profile')))
    kw_overrides = copy.deepcopy(kwargs)
    def select(key, default=None):
        kw_overrides_match = kw_overrides.pop(key, _marker)
        profile_match = profile.pop(key, default)
        if (kw_overrides_match is _marker):
            return profile_match
        return kw_overrides_match
    template = select('template')
    image = select('image')
    vgname = select('vgname')
    path = kwargs.get('path', None)
    for param in ('path', 'image', 'vgname', 'template'):
        kwargs.pop(param, None)
    if image:
        proto = _urlparse(image).scheme
        img_tar = __salt__['cp.cache_file'](image)
        img_name = os.path.basename(img_tar)
        hash_ = salt.utils.get_hash(img_tar, __salt__['config.get']('hash_type'))
        name = '__base_{0}_{1}_{2}'.format(proto, img_name, hash_)
        if (not exists(name, path=path)):
            create(name, template=template, image=image, path=path, vgname=vgname, **kwargs)
            if vgname:
                rootfs = os.path.join('/dev', vgname, name)
                edit_conf(info(name, path=path)['config'], out_format='commented', **{'lxc.rootfs': rootfs})
        return name
    elif template:
        name = '__base_{0}'.format(template)
        if (not exists(name, path=path)):
            create(name, template=template, image=image, path=path, vgname=vgname, **kwargs)
            if vgname:
                rootfs = os.path.join('/dev', vgname, name)
                edit_conf(info(name, path=path)['config'], out_format='commented', **{'lxc.rootfs': rootfs})
        return name
    return ''