used the Cmd module to replace the original command line loop, it gives ...

I used the Cmd module to replace the original command like loop so that you get a nice command history that is just an up arrow away. Also changed tabs to spaces to be pep-8 compliant.