Scope is to throw any mail, html or plain or multipart into this and receive a readable formatted text that deals with special characters and html issues. Field of usage: System that imports mails into a mysql db, or prints them to pdf etc. What can I improve here?import imapclient, pyzmail, html2textConnect to IMAP. Login and select folder.retreive UID of Mails and fetch the latest.return the body of the latest messagedef latestMail():    imapObj = imapclient.IMAPClient('imap.server.com', ssl=False)    imapObj.login('username', 'password')    imapObj.select_folder('INFO', readonly=True)    UIDs = imapObj.search(criteria='ALL', charset=None)    rawMessages = imapObj.fetch(UIDs[0], ['BODY[]', 'FLAGS'])    message = pyzmail.PyzMessage.factory(rawMessages[UIDs[0]]['BODY[]'])    return messageOpen message object, check if content is html or plain or both.If both, only plain will be taken. for Plain, decodes themessage if charset is given, if not we will use system defaultfor html, additionally format html so the informationis exportable to any db.def parser(message):    if message.text_part is not None and message.html_part is not None:        multipart = True    else:        multipart = False    if message.text_part is not None:        try:            body = message.text_part.get_payload().decode(message.text_part.charset)        except TypeError:            body = message.text_part.get_payload()    if message.html_part is not None and multipart is False:        try:            body = html2text.html2text(message.html_part.get_payload().decode(message.html_part.charset))        except Exception:            raise Systemexit    return bodyprint parser(latestMail())
format any mail into readable text
python;html;python 2.7;email