span class="sd">        metric: The metric by which the best checkpoint would be chosen, like</span>
<span class="sd">                &#39;episode_reward_mean&#39;</span>
<span class="sd">        mode: One of [min, max].</span>

<span class="sd">    Returns:</span>
<span class="sd">        string (path to checkpoint)</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">trial_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><