def METHOD_NAME():
    hostname = raw_input("IMAP4 Server Hostname: ")
    port = raw_input("IMAP4 Server Port (the default is 143, 993 uses SSL): ")
    # Usernames are bytes.
    username = raw_input("IMAP4 Username: ").encode("ascii")
    # Passwords are bytes.
    password = util.getPassword("IMAP4 Password: ").encode("ascii")
    onConn = (
        defer.Deferred()
        .addCallback(cbServerGreeting, username, password)
        .addErrback(ebConnection)
        .addBoth(cbClose)
    )
    factory = SimpleIMAP4ClientFactory(username, onConn)
    if not port:
        port = 143
    else:
        port = int(port)
    from twisted.internet import reactor
    endpoint = endpoints.HostnameEndpoint(reactor, hostname, port)
    if port == 993:
        if isinstance(hostname, bytes):
            # This is python 2
            hostname = hostname.decode("utf-8")
        contextFactory = ssl.optionsForClientTLS(
            hostname=hostname,
        )
        endpoint = endpoints.wrapClientTLS(contextFactory, endpoint)
    endpoint.connect(factory)
    reactor.run()