I found an issue with
if not i.startswith('SELECT') and not i.startswith('select') and not i.startswith('with '): in rewriter.py. I had to also add "WITH", so changed it to
if not i.startswith('SELECT') and not i.startswith('select') and not i.startswith('with ') and not i.startswith('WITH'):