Python package for hacking LaTeX documents (extracted from preprint)