Python - Reencaminhar email IMAP com anexos (imaplib, smtplib)

Estou tendo problemas para encaminhar emails com anexos. Alguém pode me apontar na direção certa? Acho que está na instrução Buscar, mas não tenho certez

import sys
import uuid
import re
import smtplib
import email

address = ''
username = ''
password = ''

def checkMail():
    M = imaplib.IMAP4_SSL(address)
    M.login(username, password)
    M.select("INBOX", readonly=True)
    typ, data = M.search(None, 'Unseen')

    messageCount = len(data[0].split())    
    print('messageCount: %', messageCount)
    if messageCount > 0:     
        for num in data[0].split():
            typ, data = M.fetch(num, '(BODY[TEXT])')
            foundAt = data[0][1].find('Content-Type: application')
            if(foundAt > 0):
                print('attachmentfound')
                sendMail(data[0][1])


    M.close()
    M.logout()       


def sendMail(raw_message):

    toAddress = ''
    fromAddress = ''
    LOGIN    = ''
    PASSWORD = ''


    server = smtplib.SMTP('', 587)
    server.set_debuglevel(1)
    server.ehlo()
    server.starttls()
    server.login(LOGIN, PASSWORD)
    server.sendmail(fromAddress, toAddress, raw_message)
    server.quit()

def main():
    checkMail()

main()

questionAnswers(2)

yourAnswerToTheQuestion