Cleaning and documenting parse_{batch,output}.py.

Added some docstrings and split a function that was being used for two
different things.