def yaml_load(source, loader=yaml.Loader):
 def construct_yaml_str(self, node):
  u'Override the default string handling function to always return Unicode objects.'
  return self.construct_scalar(node)
 class Loader(loader, ):
  u'Define a custom loader to leave the global loader unaltered.'
 Loader.add_constructor(u'tag:yaml.org,2002:str', construct_yaml_str)
 return yaml.load(source, Loader)

def yaml_load ( source , loader = yaml . Loader ) : def construct_yaml_str ( self , node ) : return self . construct_scalar ( node ) class Loader ( loader , ) : Loader . add_constructor ( u'tag:yaml.org,2002:str' , construct_yaml_str ) return yaml . load ( source , Loader )
wrap pyyamls loader so we can extend it to suit our needs .