def ordered_dump(data, Dumper=yaml.Dumper, **kws):
class OrderedDumper(Dumper):<EOL><INDENT>pass<EOL><DEDENT>def _dict_representer(dumper, data):<EOL><INDENT>return dumper.represent_mapping(<EOL>yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,<EOL>data.items())<EOL><DEDENT>OrderedDumper.add_representer(OrderedDict,<EOL>_dict_representer)<EOL>return yaml.dump(data, None, OrderedDumper, **kws)<EOL>
Expand PyYAML's built-in dumper to support parsing OrderedDict. Return
    a string as parse result of the original data structure, which includes
    OrderedDict.

    Args:
        data: the data structure to be dumped(parsed) which is supposed to
        contain OrderedDict.
        Dumper: the yaml serializer to be expanded and used.
        kws: extra key-value arguments to be passed to yaml.dump.