an class="k">def</span><span class="w"> </span><span class="nf">_is_within_directory</span><span class="p">(</span><span class="n">directory</span><span class="p">:</span><span class="nb">str</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span><span class="nb">str</span><span class="p">):</span>
            <span class="n">abs_directory</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span cla