Migrate Piers Lauder's imaplib2 library to Python3