def addcr(text):
    """Adds a cr if it needs one.

    >>> addcr("foo")
    'foo\\n'
    >>> addcr("foo\\n")
    'foo\\n'

    :returns: string with \\n at the end
    """
    if not text.endswith("\n"):
        return text + "\n"
    return text