code: def string_presenter(self, dumper, data):
      
      if '\n' in data:
        return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
      else:
        return dumper.represent_scalar('tag:yaml.org,2002:str', data)
docs: Presenter to force yaml.dump to use multi-line string style.