'Take a necessary step towards being able to begin a mail transaction.
The step may be to ask the server to being a TLS session.  If TLS is
already in use or not necessary and not available then the step may be
to authenticate with the server.  If TLS is necessary and not available,
fail the mail transmission attempt.
This is an internal helper method.
@param code: The server status code from the most recently received
server message.
@type code: L{int}
@param resp: The server status response from the most recently received
server message.
@type resp: L{bytes}
@param items: A mapping of ESMTP extensions offered by the server.  Keys
are extension identifiers and values are the associated values.
@type items: L{dict} mapping L{bytes} to L{bytes}
@return: L{None}'

def tryTLS(self, code, resp, items):

    hasTLS = self._tlsMode
    canTLS = (self.context and ('STARTTLS' in items))
    mustTLS = self.requireTransportSecurity
    if (hasTLS or (not (canTLS or mustTLS))):
        self.authenticate(code, resp, items)
    elif canTLS:
        self._expected = [220]
        self._okresponse = self.esmtpState_starttls
        self._failresponse = self.esmtpTLSFailed
        self.sendLine('STARTTLS')
    else:
        self.esmtpTLSRequired()
