human
I wrote the below code

    from r2.lib.pages import Share, Mail_Opt
    now = datetime.datetime.now(g.tz)
    if (not c.site):
        c.site = DefaultSR()
    clear = False
    if (not test):
        session = smtplib.SMTP(g.smtp_server)
    def sendmail(email):
        try:
            mimetext = email.to_MIMEText()
            if (mimetext is None):
                print ('Got    None    mimetext    for    email    from    %r    and    to    %r' % (email.fr_addr, email.to_addr))
            if test:
                print mimetext.as_string()
            else:
                session.sendmail(email.fr_addr, email.to_addr, mimetext.as_string())
                email.set_sent(rejected=False)
        except (smtplib.SMTPRecipientsRefused, smtplib.SMTPSenderRefused, UnicodeDecodeError, AttributeError, HeaderParseError):
            print 'Handled    error    sending    mail    (traceback    to    follow)'
            traceback.print_exc(file=sys.stdout)
            email.set_sent(rejected=True)
    try:
        for email in Email.get_unsent(now):
            clear = True
            should_queue = email.should_queue()
            if (email.kind == Email.Kind.SHARE):
                if should_queue:
                    email.body = Share(username=email.from_name(), msg_hash=email.msg_hash, link=email.thing, body=email.body).render(style='email')
                else:
                    email.set_sent(rejected=True)
                    continue
            elif (email.kind == Email.Kind.OPTOUT):
                email.body = Mail_Opt(msg_hash=email.msg_hash, leave=True).render(style='email')
            elif (email.kind == Email.Kind.OPTIN):
                email.body = Mail_Opt(msg_hash=email.msg_hash, leave=False).render(style='email')
            elif (not email.body):
                print ('Rejecting    email    with    an    empty    body    from    %r    and    to    %r' % (email.fr_addr, email.to_addr))
                email.set_sent(rejected=True)
                continue
            sendmail(email)
    finally:
        if...

What's a good function header?
 Write me a Python program to print ('Got    None    mimetext    for    email    from    %r    and    to    %r' % (email?
assistant
#Here is Python program to print ('Got    None    mimetext    for    email    from    %r    and    to    %r' % (email.

def send_queued_mail(test=False):