Good. I found out that email.utils can help a lot here.
It has methods for analyzing date, email, and any other information from imap messages.
It also has methods for decoding imap strings. Like this
from email.header import decode_header
value, charset = decode_header(string_to_be_decoded)
user250145