The paper focuses on converting output graphs into semantically equivalent Python code.The COCOGEN approach transforms the output graph G into a program written in Python.The transformed Python code is used as training or few-shot examples for structured commonsense generation tasks.The method utilizes CODEX for generating syntactically valid Python code from prompts.