'Sets up the yaml loader to return unicode objects for strings by default'

def setup_yaml(self):

    def construct_yaml_str(self, node):
        return self.construct_scalar(node)
    yaml.Loader.add_constructor(u'tag:yaml.org,2002:str', construct_yaml_str)
    yaml.SafeLoader.add_constructor(u'tag:yaml.org,2002:str', construct_yaml_str)
    def unicode_representer(dumper, uni):
        node = yaml.ScalarNode(tag=u'tag:yaml.org,2002:str', value=uni)
        return node
    yaml.add_representer(str, unicode_representer)
    def increase_indent_wrapper(func):
        def increase_indent(self, flow=False, indentless=False):
            func(self, flow, False)
        return increase_indent
    yaml.Dumper.increase_indent = increase_indent_wrapper(yaml.Dumper.increase_indent)
    yaml.SafeDumper.increase_indent = increase_indent_wrapper(yaml.SafeDumper.increase_indent)
