title: Slice a string after a certain phrase?
body: <p>I've got a batch of strings that I need to cut down. They're basically a descriptor followed by codes. I only want to keep the descriptor.</p>
  
  <pre><code>'a descriptor dps 23 fd'
  'another 23 fd'
  'and another fd'
  'and one without a code'
  </code></pre>
  
  <p>The codes above are <code>dps</code>, <code>23</code> and <code>fd</code>. They can come in any order, are unrelated to each other and might not exist at all (as in the last case).</p>
  
  <p>The list of codes is fixed (or can be predicted, at least), so assuming a code is never used within a legitimate descriptor, how can I strip off everything after the first instance of a code.</p>
  
  <p>I'm using Python.</p>