import six


def dedupe_newlines(s):
    """yaml.safe_dump converts single newlines to double.

    Since we're printing this output and not loading it, we should
    deduplicate them.
    """

    if isinstance(s, six.string_types):
        s = s.replace("\n\n", "\n")

    return s