def quoted_presenter(dumper, data):
    'Re-presenter which always double quotes string values needing escapes.'
    if (('\n' in data) or ('\t' in data) or ("'" in data)):
        return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='"')
    else:
        return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='')
Re-presenter which always double quotes string values needing escapes.
def quoted_presenter(dumper, data):
    
    if (('\n' in data) or ('\t' in data) or ("'" in data)):
        return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='"')
    else:
        return dumper.represent_scalar('tag:yaml.org,2002:str', data, style=)