title: Split text after the second occurrence of character
body: <p>I need to split text before the second occurrence of the '-' character.  What I have now is producing inconsistent results.  I've tried various combinations of <code>rsplit</code> and read through and tried other solutions on SO, with no results.</p>
  
  <p>Sample file name to split: <code>'some-sample-filename-to-split'</code> returned in <code>data.filename</code>. In this case, I would only like to have <code>'some-sample'</code> returned.  </p>
  
  <pre><code>fname, extname = os.path.splitext(data.filename)
  file_label = fname.rsplit('/',1)[-1]
  file_label2 = file_label.rsplit('-',maxsplit=3)
  print(file_label2,'\n','---------------','\n')
  </code></pre>