Converting chapter to fenced code blocks with 4 spaces instead of tabs

I used a python script to convert tabbed/spaced code blocks into cpp fenced code blocks.  It uses 4 spaces per tab.  It's based on a regular expression rather than doing markdown parsing, so it's probably easy to break.  I'm including it since it might be helpful for others who used vanilla markdown for their code.