title: Regex to match key in YAML
body: <p>I have a yaml which looks like this..! User can define N number of <code>xyz_flovor_id</code> where <code>_flovor_id</code> key will be common. Aim is to grab <code>*_flavor_id</code> key and extract value out of it. </p>
  
  <pre><code>  server:
      tenant: "admin"
      availability_zone: "nova"
      cpu_overcommit_ratio: 1:1
      memory_overcommit_ratio: 1:1
      xyz_flovor_id: 1
      abc_flavor_id: 2
  </code></pre>
  
  <p>I am able to figure the regex to match the <code>_flovor_id</code>. however while trying to use this in code it's throwing Error. 
  here is my code.</p>
  
  <pre><code>def get_flavor_keys(params):
      pattern = re.compile(r'[^*]flavor_id')
      for key, value in params.iteritems():
          print value
          if key == 'server':
              if pattern.match(value):
                  print 'test'
  </code></pre>
  
  <p><code>print value</code> is dumping entire YAML file (expected). Immediate traceback after that.</p>
  
  <pre><code>Traceback (most recent call last):
    File "resource_meter.py", line 150, in &lt;module&gt;
      get_flavor_keys(items)
    File "resource_meter.py", line 15, in get_flavor_keys
      if pattern.match(value):
  TypeError: expected string or buffer
  </code></pre>