def remove(mod, persist=False, comment=True):
    '''
    Remove the specified kernel module

    mod
        Name of module to remove

    persist
        Also remove module from /boot/loader.conf

    comment
        If persist is set don't remove line from /boot/loader.conf but only
        comment it

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.remove vmm
    '''
    pre_mods = lsmod()
    res = __salt__['cmd.run_all']('kldunload {0}'.format(mod),
                            python_shell=False)
    if res['retcode'] == 0:
        post_mods = lsmod()
        mods = _rm_mods(pre_mods, post_mods)
        persist_mods = set()
        if persist:
            persist_mods = _remove_persistent_module(mod, comment)
        return sorted(list(mods | persist_mods))
    else:
        return 'Error removing module {0}: {1}'.format(mod, res['stderr'])
Remove the specified kernel module

    mod
        Name of module to remove

    persist
        Also remove module from /boot/loader.conf

    comment
        If persist is set don't remove line from /boot/loader.conf but only
        comment it

    CLI Example:

    .. code-block:: bash

        salt '*' kmod.remove vmm