Python3 encoding and decoding utilities for the IMAP modified UTF-7 encoding. See RFC2152
This is a direct port from the python 2 version from Mailpile
This version works better than the one found in imapclient, which fails to do roundtrip encoding in some situations like:
from imap_utf7 import encode, decode
s = 'foo\r\n\nbar\n'
assert s == decode(encode(s))
Although control characters are usually rejected by IMAP servers.
I will add some unittests when I find the time, finish the porting properly and maybe switch to an in-place implementation for better performance