PyMOTW: shlex

The shlex module can be used to create mini-languages using a simple syntax like the Unix shell. It is also handy for parsing quoted strings.

Read more at pymotw.com: shlex