def yaml_formatter(table_name, table_dict):
 special_table_list = ['name', 'OS/2', 'TTFA']
 if (table_name in special_table_list):
  if (table_name == 'name'):
   return name_yaml_formatter(table_dict)
  elif (table_name == 'OS/2'):
   return os2_yaml_formatter(table_dict)
  elif (table_name == 'TTFA'):
   return ttfa_yaml_formatter(table_dict)
 else:
  table_string = (table_name.strip() + ': {\n')
  for field in table_dict.keys():
   table_string = (((((table_string + (' ' * 4)) + field) + ': ') + str(table_dict[field])) + ',\n')
  table_string += '}\n\n'
  return table_string

def yaml_formatter ( table_name , table_dict ) : special_table_list = [ 'name' , 'OS/2' , 'TTFA' ] if ( table_name in special_table_list ) : if ( table_name == 'name' ) : return name_yaml_formatter ( table_dict ) elif ( table_name == 'OS/2' ) : return os2_yaml_formatter ( table_dict ) elif ( table_name == 'TTFA' ) : return ttfa_yaml_formatter ( table_dict ) else : table_string = ( table_name . strip ( ) + ': {\n' ) for field in table_dict . keys ( ) : table_string = ( ( ( ( ( table_string + ( ' ' * 4 ) ) + field ) + ': ' ) + str ( table_dict [ field ] ) ) + ',\n' ) table_string += '}\n\n' return table_string
creates a yaml formatted string for opentype table font reports .