Sometimes, writing a command-line tool is not enough, and you need to be able to provide some sort of interactivity. Suppose you want to write a mail client. In this case, it's not very convenient to have to call mymail list to see your mail, or mymail read to read a specific mail from your shell, and so on. Furthermore, if you want to implement stateful behaviors—such as a mymail reply instance that should reply to the current mail you are viewing—this might not even be possible.
Interactive programs are better in these cases, and the Python standard library provides all the tools we need to write one through the cmd module.
We can try to write an interactive shell for our mymail program; it won't read real email, but we will fake the behavior enough to showcase a fully featured shell.