IMAPdedup
From time to time I end up with duplicate email messages in an IMAP mailbox, often as part of copying and archiving mail, or sometimes simply as a result of being on the recipient list for messages more than once.
Deleting these by hand is a nuisance, so I created a Python script that would do it for me.
You can get IMAPdedup from GitHub. The documentation is now there.
It’s Open Source and comes with no warranties, etc. Make sure you have backups. Hope it’s useful!