Python: add triple doc quotes and handle expansion of `"|"`

typo "Generate"