def decrypt(self, key, data, mode, padding):
        # this can be disabled by _disable_encryption, so pylint: disable=method-hidden
        """Decrypt data using the supplied values.

        :param bytes key: Loaded decryption key
        :param bytes data: IV prepended to encrypted data
        :param JavaMode mode: Decryption mode to use
        :param JavaPadding padding: Padding mode to use
        :returns: Decrypted data
        :rtype: bytes
        """
        try:
            block_size = self.cipher.block_size
            iv_len = block_size // 8
            iv = data[:iv_len]
            data = data[iv_len:]

            decryptor = Cipher(self.cipher(key), mode.build(iv), backend=default_backend()).decryptor()
            decrypted_data = decryptor.update(data) + decryptor.finalize()

            unpadder = padding.build(block_size).unpadder()
            return unpadder.update(decrypted_data) + unpadder.finalize()
        except Exception:
            error_message = "Decryption failed"
            _LOGGER.exception(error_message)
            raise DecryptionError(error_message)
Decrypt data using the supplied values.

        :param bytes key: Loaded decryption key
        :param bytes data: IV prepended to encrypted data
        :param JavaMode mode: Decryption mode to use
        :param JavaPadding padding: Padding mode to use
        :returns: Decrypted data
        :rtype: bytes