span class="bp">self</span><span class="p">,</span> <span class="n">types_allow</span> <span class="o">=</span> <span class="p">[]):</span>
    <span class="sd">&quot;&quot;&quot;convert self to a json friendly object.</span>

<span class="sd">    Usage: json.dumps(X.json())</span>
<span class="sd">    &quot;&quot;&quot;</span>
    
    <span class="c"># class encoding doesn&#39;t work yet:</span>
    <span class="n">return_dict</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;cl