google search 'imap admin access' returns this post.
at first, I think python's imaplib.proxyauth is the intuitive way.
so here is the demo code:
hostname, username, password = get_config()
conn = imaplib.IMAP4_SSL(hostname)
typ, cap = conn.login(username, password)   # username is a admin
however, proxyauth raise a error "imaplib.error: PROXYAUTH command error: BAD ['parse error: command not implemented']

after some debuging, it seems the line "conn.login(username, password)" will translated to send the tcp string 'PALI1 LOGIN username "password"\r\n', this works. and the line "conn.proxyauth("user1")" will translated to 'PALI2 PROXYAUTH user1\r\n', and it failed.

so I wonder how imapsync, as this post said, knows to do this delegated authentication.

imapsync's "imapsync --host1 --user1 username --authuser1 adminusername --password1 adminpassword " will translated to what TCP protocal string?