Just a note that this script does not decrypt the older "RC2" encryption, only the latter "AES" encryption, at least, I couldn't get it to work at all. I even added debug to the python code to confirm.
The only thing that worked for me was search for all notes with encryption, add them to a new notebook, then go through each and decrypt permanently, then export that notebook, then re-import into the destination and deal with duplicates there.
So glad I found out now that the export silently ignores all encrypted text as I had cancelled my subscription several weeks ago.
I get that it shouldn't just blindly decrypt, but I would have appreciated a warning that it was explicitly NOT going to do anything, and that that information would have been lost.