title: Parsing Yaml in Python: Detect duplicated keys
body: <p>The <code>yaml</code> library in python is not able to detect duplicated keys. This is a bug that <a href="http://pyyaml.org/ticket/128" rel="noreferrer">has been reported years ago</a> and there is not a fix yet.</p>
  
  <p>I would like to find a decent workaround to this problem. How plausible could be to create a <code>regex</code> that returns all the keys ? Then it would be quite easy to detect this problem. </p>
  
  <p>Could any regex master suggest a regex that is able to extract all the keys to find duplicates ?</p>
  
  <p>File example:</p>
  
  <pre><code>mykey1:
      subkey1: value1
      subkey2: value2
      subkey3:
        - value 3.1
        - value 3.2
  mykey2:
      subkey1: this is not duplicated
      subkey5: value5
      subkey5: duplicated!
      subkey6:
         subkey6.1: value6.1
         subkey6.2: valye6.2
  </code></pre>