<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _htfile(username, password, **kwargs):
    '''
    Gate function for _htpasswd and _htdigest authentication backends
    '''

    filetype = kwargs.get('filetype', 'htpasswd').lower()

    try:
        import passlib
        kwargs['passlib_version'] = passlib.__version__
    except ImportError:
        log.error('salt.auth.file: The python-passlib library is required '
                  'for %s filetype', filetype)
        return False

    if filetype == 'htdigest':
        return _htdigest(username, password, **kwargs)
    else:
        return _htpasswd(username, password, **kwargs)