I just found out about a nice python library that does this (`shlex.split(string)`)