@echatzikyriakidis thanks. The code was created for showcasing in a workshop so definitely it can be made more configurable etc. You can check the code if needed in a recent workshop I gave here 66.
I think as @valhalla mentioned we can use that attribute as an argument \ config for the function to reuse it across different models.