def ValidateAttributes(tag, attributes, goodattributes):
 all_good = True
 for attr in attributes.keys():
  if (not (attr in goodattributes)):
   output.Error(('Unknown %s attribute: %s' % (tag, attr)))
   all_good = False
 return all_good

def ValidateAttributes ( tag , attributes , goodattributes ) : all_good = True for attr in attributes . keys ( ) : if ( not ( attr in goodattributes ) ) : output . Error ( ( 'Unknown %s attribute: %s' % ( tag , attr ) ) ) all_good = False return all_good
makes sure attributes does not contain any attribute not listed in goodattributes .