Moved more functionality from main code into produce method in order to provide a usable programmatic interface. Now takes a list of command line arguments rather than an argparse-style Namespace object or a dictionary (who'd have thought it's so hard to add another attribute to a Python object).
Now that the main code is only a very thin wrapper, the test suite calls produce programmatically so it's faster and we can easily check for errors using assertRaises.
Added additional test for braces, inspired by #2.