CGA shape grammar expressed in Python