No bug - implement preprocess.sh functionality in Python.

@rnewman: take a look?  Diff reveals no changes before and after.  Small bonus: it's faster!