def METHOD_NAME(server, username, password):
    auth = lambda data : f'\x00{username}\x00{password}'
    print(f'Authenticating to imaps://{username}:{password}@{server}:993/')
    with imaplib.IMAP4_SSL(server) as conn:
        conn.authenticate('PLAIN', auth)
        conn.noop()
    print('OK')
    print(f'Authenticating to imaps://{username}:{password}@{server}:143/')
    with imaplib.IMAP4(server) as conn:
        conn.starttls()
        conn.authenticate('PLAIN', auth)
        conn.noop()
    print('OK')
    print(f'Authenticating to imap://{username}:{password}@{server}:143/')
    try:
        with imaplib.IMAP4(server) as conn:
            conn.authenticate('PLAIN', auth)
        print(f'Authenticating to imap://{username}:{password}@{server}:143/ worked without STARTTLS!')
        sys.exit(102)
    except imaplib.IMAP4.error:
        print('NOK - expected')