'Decode base64 email and turn it into a Django email object.'

def __init__(self, email_text):

    try:
        email_text = base64.standard_b64decode(urllib2.unquote(email_text.rstrip()))
    except TypeError:
        self.decode_error = True
        log.info('Decoding    error    for    CommEmailParser')
        return
    self.email = message_from_string(email_text)
    payload = self.email.get_payload()
    if isinstance(payload, list):
        for part in payload:
            if (part.get_content_type() == 'multipart/alternative'):
                payload = part.get_payload()
                for part in payload:
                    if (part.get_content_type() == 'text/plain'):
                        payload = part.get_payload()
                        break
            if (part.get_content_type() == 'text/plain'):
                payload = part.get_payload()
                break
    payload = quopri.decodestring(payload).replace('\xc2\xa0', '    ')
    payload = self.extra_email_reply_parse(payload)
    self.reply_text = EmailReplyParser.read(payload).reply
