Use shlex for config file parsing.

It works for quoted string arguments even if they have spaces or hash symbols; the current code doesn't.  It's also more concise.
Please keep the argument named `opened_file` (or `file_obj` -- we would use `file` but we are not on Python3 yet).