Thanks for this
I ran into two more issues. The blocker was that groups.io blocked message import from the script after 40 messages and told me to try again later. About an hour later I still couldn't import any more messages from that email address (I reconfigured to use a different email address for import and processed another 40 messages before that too got blocked).
The other issue was that your script said my mbox archive had "9022 messages (deleted messages excluded)" But Thunderbird finds the expected 15,000 messages in the mbox which matches the number in seen in PG Offline and in Yahoo itself.
Also, imported messages show the date and time of import, not of the original message
So yesterday, in the window while groups.io was open to accept new transfer requests, we booked a transfer. But in case they don't manage to get it done I've also requested a fresh mbox download from Yahoo!
Thanks for your sharing your work.