title: Serialize Python code object (from compile())
body: <p>After creating a Python code object via</p>
  <pre class="lang-py prettyprint-override"><code>code = &quot;&quot;&quot;a = 5
  a += 6
  print(a)
  &quot;&quot;&quot;
  
  obj = compile(code, &quot;foobar.py&quot;, &quot;exec&quot;)
  print(obj)
  </code></pre>
  <pre><code>&lt;code object &lt;module&gt; at 0x7f6bef0ea190, file &quot;foobar.py&quot;, line 1&gt;
  </code></pre>
  <p>I would like to store that object in a string or file such that I can later construct the obj from the file again. (I do not want to store the plain string.)</p>