<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connectMSExchange(server):
 """ Creates a connection for the inputted server to a Microsoft Exchange server. :param server | <smtplib.SMTP> :return (<bool> success, <str> reason) """

    if not sspi:
        return False, 'No sspi module found.'

    # send the SMTP EHLO command
    code, response = server.ehlo()
    if code != SMTP_EHLO_OKAY:
        return False, 'Server did not respond to EHLO command.'

    sspi_client = sspi.ClientAuth('NTLM')

    # generate NTLM Type 1 message
    sec_buffer = None
    err, sec_buffer = sspi_client.authorize(sec_buffer)
    # noinspection PyShadowingBuiltins
    buffer = sec_buffer[0].Buffer
    ntlm_message = base64.encodestring(buffer).replace('\n', '')

    # send NTLM Type 1 message -- Authentication Request
    code, response = server.docmd('AUTH', 'NTLM ' + ntlm_message)

    # verify the NTLM Type 2 response -- Challenge Message
    if code != SMTP_AUTH_CHALLENGE:
        msg = 'Server did not respond as expected to NTLM negotiate message'
        return False, msg

    # generate NTLM Type 3 message
    err, sec_buffer = sspi_client.authorize(base64.decodestring(response))
    # noinspection PyShadowingBuiltins
    buffer = sec_buffer[0].Buffer
    ntlm_message = base64.encodestring(buffer).replace('\n', '')

    # send the NTLM Type 3 message -- Response Message
    code, response = server.docmd('', ntlm_message)
    if code != SMTP_AUTH_OKAY:
        return False, response

    return True, ''