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

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

    assert type(nc) == dict

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

    if not nc["startup"].endswith("\n"):
        nc["startup"] += "\n"
    nc["startup"] += line + "\n"