Ensure that the appropriate versionlock plugin is present

def _check_versionlock():
    '''
    Ensure that the appropriate versionlock plugin is present
    '''
    if _yum() == 'dnf':
        if int(__grains__.get('osmajorrelease')) >= 26:
            if six.PY3:
                vl_plugin = 'python3-dnf-plugin-versionlock'
            else:
                vl_plugin = 'python2-dnf-plugin-versionlock'
        else:
            if six.PY3:
                vl_plugin = 'python3-dnf-plugins-extras-versionlock'
            else:
                vl_plugin = 'python-dnf-plugins-extras-versionlock'
    else:
        vl_plugin = 'yum-versionlock' \
            if __grains__.get('osmajorrelease') == '5' \
            else 'yum-plugin-versionlock'

    if vl_plugin not in list_pkgs():
        raise SaltInvocationError(
            'Cannot proceed, {0} is not installed.'.format(vl_plugin)
        )