human
Here's a good function header given the following:
I wrote the below code

    if (not hasattr(msg, 'read')):
        msg = BytesIO(bytes(msg))
    def cancel(d):
        '\n                                Cancel    the    L{twisted.mail.smtp.sendmail}    call,    tell    the    factory    not    to\n                                retry    and    disconnect    the    connection.\n\n                                @param    d:    The    L{defer.Deferred}    to    be    cancelled.\n                                '
        factory.sendFinished = True
        if factory.currentProtocol:
            factory.currentProtocol.transport.abortConnection()
        else:
            connector.disconnect()
    d = defer.Deferred(cancel)
    factory = ESMTPSenderFactory(username, password, from_addr, to_addrs, msg, d, heloFallback=True, requireAuthentication=requireAuthentication, requireTransportSecurity=requireTransportSecurity)
    if (senderDomainName is not None):
        factory.domain = networkString(senderDomainName)
    connector = reactor.connectTCP(smtphost, port, factory)
    return d

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

def sendmail(smtphost, from_addr, to_addrs, msg, senderDomainName=None, port=25, reactor=reactor, username=None, password=None, requireAuthentication=False, requireTransportSecurity=False):