def add_newline(text: str) -> str:
    """
    Adds a newline if a string does not have one.
    :param text: String to add the newline character to.
    :return: String with a newline character on the end.
    """
    return text if text.endswith("\n") else text + "\n"