human
I wrote the below code

    def utf8(p):
        return p.encode('utf8', 'ignore')
    if test:
        email_server = utf8(test.get('email_server'))
        email_from = utf8(test.get('email_from'))
        email_account = utf8(test.get('email_account'))
        email_pwd = utf8(test.get('email_pwd'))
        if (email_pwd and (not email_pwd.replace('*', ''))):
            email_pwd = utf8(cfg.email_pwd())
    else:
        email_server = utf8(cfg.email_server())
        email_from = utf8(cfg.email_from())
        email_account = utf8(cfg.email_account())
        email_pwd = utf8(cfg.email_pwd())
    if (not message.strip('\n\r DCTB     ')):
        return 'Skipped    empty    message'
    if (email_server and email_to and email_from):
        message = _prepare_message(message)
        (server, port) = split_host(email_server)
        if (not port):
            port = 25
        logging.debug('Connecting    to    server    %s:%s', server, port)
        try:
            mailconn = smtplib.SMTP_SSL(server, port)
            mailconn.ehlo()
            logging.debug('Connected    to    server    %s:%s', server, port)
        except Exception as errorcode:
            if errorcode[0]:
                logging.debug('Non-SSL    mail    server    detected    reconnecting    to    server    %s:%s', server, port)
                try:
                    mailconn = smtplib.SMTP(server, port)
                    mailconn.ehlo()
                except:
                    return errormsg(T('Failed    to    connect    to    mail    server'))
            else:
                return errormsg(T('Failed    to    connect    to    mail    server'))
        if mailconn.ehlo_resp:
            m = re.search('STARTTLS', mailconn.ehlo_resp, re.IGNORECASE)
            if m:
                logging.debug('TLS    mail    server    detected')
                try:
                    mailconn.starttls()
                    mailconn.ehlo()
                except:
                    return errormsg(T('Failed    to    initiate    TLS    connection'))
       ...

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def send(message, email_to, test=None):