def verifyCryptedPassword(crypted, pw):
    """
    Use L{crypt.crypt} to Verify that an unencrypted
    password matches the encrypted password.

    @param crypted: The encrypted password, obtained from
                    the Unix password database or Unix shadow
                    password database.
    @param pw: The unencrypted password.
    @return: L{True} if there is successful match, else L{False}.
    @rtype: L{bool}
    """
    try:
        import crypt
    except ImportError:
        crypt = None

    if crypt is None:
        raise NotImplementedError("cred_unix not supported on this platform")
    if not isinstance(pw, StringType):
        pw = pw.decode('utf-8')
    if not isinstance(crypted, StringType):
        crypted = crypted.decode('utf-8')
    return crypt.crypt(pw, crypted) == crypted

    Use L{crypt.crypt} to Verify that an unencrypted
    password matches the encrypted password.

    @param crypted: The encrypted password, obtained from
                    the Unix password database or Unix shadow
                    password database.
    @param pw: The unencrypted password.
    @return: L{True} if there is successful match, else L{False}.
    @rtype: L{bool}
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/plugins/cred_unix.py