human
I wrote the below code

    class ContextFactory(object, ):
        def getContext(self):
            '\n                                                Create    a    context    for    the    server    side    of    the    connection.\n\n                                                @return:    an    SSL    context    using    a    certificate    and    key.\n                                                @rtype:    C{OpenSSL.SSL.Context}\n                                                '
            ctx = SSL.Context(SSL.TLSv1_METHOD)
            if (chainedCertFile is not None):
                ctx.use_certificate_chain_file(chainedCertFile)
            ctx.use_privatekey_file(privateKeyFile)
            ctx.check_privatekey()
            return ctx
    serverOpts = ContextFactory()
    clientOpts = sslverify.OpenSSLCertificateOptions(trustRoot=trustRoot)
    return _loopbackTLSConnection(serverOpts, clientOpts)

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

def loopbackTLSConnection(trustRoot, privateKeyFile, chainedCertFile=None):