import os
import yaml
# Define the recursive function
def iter( map, match ):
output = []
for key, value in map.iteritems():
if type( value ) == dict:
output += iter( value, match )
if key == match:
output += [ value ]
return output
f = open( infile, 'r' )
data = yaml.load( f )
f.close()
print iter( data, 'title' )