def add_tag(py_dict, tag_dict):
    """
    Helper function to add tags to the NSX object body.
    @param py_dict: the NSX object body as dict format
    @param tag_dict: tags to add. dict format.
                     e.g. {"ncp/cluster": "k8scluster"}
    """
    # Check exsiting tags
    existing_tags = []
    if "tags" in py_dict:
        for item in py_dict["tags"]:
            existing_tags.append((item.get("scope"), item.get("tag")))
    else:
        py_dict["tags"] = []
    for (key, value) in tag_dict.items():
        tag = {"scope": key, "tag": value}
        # If the tag already exists, skip it.
        if tag in existing_tags:
            pass
        else:
            py_dict["tags"].append(tag)
    return py_dict