'When using an encrypted / secured PDF file with the PDF Standard
encryption handler, this function will allow the file to be decrypted.
It checks the given password against the document\'s user password and
owner password, and then stores the resulting decryption key if either
password is correct.
It does not matter which password was matched.  Both passwords provide
the correct decryption key that will allow the document to be used with
this library.
:param str password: The password to match.
:return: ``0`` if the password failed, ``1`` if the password matched the user
password, and ``2`` if the password matched the owner password.
:rtype: int
:raises NotImplementedError: if document uses an unsupported encryption
method.'

def decrypt(self, password):

    self._override_encryption = True
    try:
        return self._decrypt(password)
    finally:
        self._override_encryption = False
