Add one-liner script or several lines (newline separated)

def add_greeting(nc, line):
    """Add one-liner script or several lines (newline separated)"""

    assert type(nc) == dict

    nc["greeting"] = nc.get("greeting") or ""

    # Markdown hard line break is two new lines
    if not nc["greeting"].endswith("\n"):
        nc["greeting"] += "\n"
    nc["greeting"] += line + "\n"