Cog: Use pieces of Python code as generators in your source files

Cog: Use pieces of Python code as generators in your source files

When cog runs, it discards the last generated Python output, executes the generator Python code, and writes its generated output into the file. Because the marker lines accommodate any language syntax, the markers can hide the cog Python code from the source file. Your Python code can be block-indented to match the surrounding text in the source file, and cog will re-indent the output to fit as well.

Source: nedbatchelder.com