def _htpasswd(username, password, **kwargs):
    '''
    Provide authentication via Apache-style htpasswd files
    '''

    from passlib.apache import HtpasswdFile

    pwfile = HtpasswdFile(kwargs['filename'])

    # passlib below version 1.6 uses 'verify' function instead of 'check_password'
    if salt.utils.versions.version_cmp(kwargs['passlib_version'], '1.6') < 0:
        return pwfile.verify(username, password)
    else:
        return pwfile.check_password(username, password)
Provide authentication via Apache-style htpasswd files