Add matrix code generator (python)