def convert_to_yaml_struct(self):
    x = CommentedMap()
a = CommentedMap()
x[data.name] = a
x.yaml_add_eol_comment('this is the name', 'boby', 11)
a['age'] = data.age
a.yaml_add_eol_comment('in years', 'age', 11)
return x

@staticmethod
def yaml_representer(dumper, data, flow_style=False):
    pass
Добавление комментариев в YAML, созданное с помощью PyYaml