class News(object): pass

def news_representer(dumper, news):
    # skip converting a news in a dict:
    data = {
        'date': '732638',
        'fields': {
            '': {},
            'it': {'title': 'Hello World'}
        },
        'guid': '0000010f153544cf8a314808007f000000000001',
        'expiration': None
    }
    return dumper.represent_mapping('!news', data)

def news_constructor(loader, node):
    nodes = loader.construct_mapping(node)
    print nodes
    return nodes

import yaml

yaml.add_representer(News, news_representer)
yaml.add_constructor('!news', news_constructor)

foo = News()

bar = yaml.load(yaml.dump(foo))
print bar
