Model-generator in python