I would like to know if any "official" function/library existed in Python for IMAP4 UTF-7 folder path encoding.
'(\\HasNoChildren) "." "[Mails].Test&AOk-"',
The IMAPClient package has functionality for encoding and decoding using IMAP's modified UTF-7. Have a look in the IMAPClient.imap_utf7 module. This module could be used standalone or you could just use IMAPClient which handles doing the encoding and decoding of folder names transparently.
The project's home page is: http://imapclient.freshfoo.com/
from imapclient import imap_utf7 decoded = imap_utf7.decode('&BdAF6QXkBdQ-')