s="p">[]</span>

    <span class="c1"># define chain selector if chain is given</span>
    <span class="k">if</span> <span class="n">chain</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
        <span class="n">chain_sel</span> <span class="o">=</span> <span class="s2">&quot; and chain &#39;</span><span class="si">{}</span><span class="s2">&#39;&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span cl