We have now a way how to template our Jenkins pipelines via Python's Jinja2 and thus implement some kind of "inheritance" in our templates.
Also note that Jinja2 is way more flexible than shown in this post: e.g. it allows to pass template variables to its render() method. Those variables would then get passed to the template which then makes use of them. This allows you to code more complex templates than shown here. It also has so-called include statements which you can use to split up large templates. For a nice intro have a look at this article.
Also as a last note: because we have both the templates and the Python script in our shared library, we could actually write a pipeline that automatically generates the pipelines. But this is left as an exercies for the motivated reader (hint: you will need to come up with a way to execute scripts under resources from within a pipeline step. See e.g. https://stackoverflow.com/a/50827874/4804137 ) :)