title: Generate a combination of URL endpoints
body: <p>I have a URL as follows: </p>
  
  <pre><code>http://example.com/foo/bar/baz/file.php
  </code></pre>
  
  <p>and I have an endpoint named <code>/potato</code>.</p>
  
  <p>I would like to generate the following URLs from these:</p>
  
  <pre><code>http://example.com/foo/potato
  http://example.com/foo/bar/potato
  http://example.com/foo/bar/baz/potato
  </code></pre>
  
  <p>My attempts so far involved splitting at slashes, and it misses the case when the endpoint itself begins with a <code>/</code> etc.</p>
  
  <p>What's the cleanest and Pythonic way to accomplish this?</p>