generate monkeypatching templates from Python