Bending tubes for OpenFOAM

For some reason I have been looking for an easy method to create a meshed gas line with various bends. Our favourite search engine returned an undisclosed solution by Kjetil Moe: Automating blockMesh pipe geometries in OpenFOAM. Unfortunately, access to the OpenFOAM Pipemesher is restricted. So, how hard could it be to automate the creation of a blockMeshDict file from a list of tube bending parameters? Today I fixed the last bug to get a working Python script and could quickly create a couple of examples, as shown below in screenshots of Paraview. A next step could be to rewrite the code and make it look pretty.
example1

example2
example3
example4
example5
example6
The first version of the Python code and the input files of the examples are available here: openTubes-0.1.