>        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="n">T</span> <span class="o">==</span> <span class="kc">None</span><span class="p">:</span>
            <span class="c1"># Returns Tree, function</span>
            <span class="k">return</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span>
        
        <span class="k">elif</span> <span class="n">nx</span><span class="o">.</span><span class="n">is_tree</span><span class="p">(</span><span 