def init_yaml_constructor():
def utf_encoding_string_constructor(loader, node):<EOL><INDENT>return loader.construct_scalar(node).encode('<STR_LIT:utf-8>')<EOL><DEDENT>yaml.SafeLoader.add_constructor(u'<STR_LIT>', utf_encoding_string_constructor)<EOL>
This dark magic is used to make yaml.safe_load encode all strings as utf-8,
where otherwise python unicode strings would be returned for non-ascii chars