title: How do I rename a key with PyYAML
body: <p>I have loaded a YAML file (template) that I want to modify (keys and some values).</p>
  
  <p>e.g.</p>
  
  <pre><code>key_to_rename:
    a: "1"
    b: "2"
    c: "3"
  </code></pre>
  
  <p>How do I find &amp; rename a key with PyYAML?</p>
  
  <pre><code>  my_dict = yaml.load(stream)
  
    for key, value in my_dict.iteritems():
       if (key == "key_to_rename"):
         print key
         key = "new_name"
         print key
  
    print yaml.dump(my_dict)
  </code></pre>
  
  <p>but that's still not persisting the change</p>