def get_body(self, msg):
        """ Extracts and returns the decoded body from an EmailMessage object"""

        body = ""
        charset = ""

        if msg.is_multipart():
            for part in msg.walk():
                ctype = part.get_content_type()
                cdispo = str(part.get('Content-Disposition'))

                # skip any text/plain (txt) attachments
                if ctype == 'text/plain' and 'attachment' not in cdispo:
                    body = part.get_payload(decode=True)  # decode
                    charset = part.get_content_charset()
                    break

        # not multipart - i.e. plain text, no attachments, keeping fingers crossed
        else:
            body = msg.get_payload(decode=True)
            charset = msg.get_content_charset()

        return body.decode(charset)
Extracts and returns the decoded body from an EmailMessage object