The IMAP4 protocol optionally uses double quoting when mailboxes contain
spaces. This is always allowed. So to fix this, first we use shlex to
perform double-quote-aware splitting (a bit like bash would split
command line arguments) and then we send folder names with quotes to the
IMAP server.
I tested this manually with a couple real IMAP servers.