docstr: This function is used to create category if category is not exists,
  crate tag if tag is not exists, and update the latest tag to VM.
docstr_tok: ["This","function","is","used","to","create","category","if","category","is","not","exists",",","crate","tag","if","tag","is","not","exists",",","and","update","the","latest","tag","to","VM","."]
code: def set_node_tags(self, vm_id, tags):
      """
      This function is used to create category if category is not exists,
      crate tag if tag is not exists, and update the latest tag to VM.
      """
      with self.lock:
          category_id = self.get_category()
          if not category_id:
              category_id = self.create_category()
  
          for key, value in tags.items():
              tag = kv_pair_to_vsphere_tag(key, value)
              tag_id = self.get_tag_id_by_name(tag, category_id)
              if not tag_id:
                  tag_id = self.create_node_tag(tag, category_id)
  
              # If a tag with a key is present on the VM, then remove it
              # before updating the key with a new value.
              self.remove_tag_from_vm(key, vm_id)
  
              logger.debug(f"Attaching tag {tag} to {vm_id}")
              self.attach_tag(
                  vm_id, Constants.TYPE_OF_RESOURCE, tag_id=tag_id
              )
  
imports: import logging
  import time
  import uuid
  from threading import RLock
  import com.vmware.vapi.std.errors_client
  import requests
  from com.vmware.cis.tagging_client import CategoryModel
  from com.vmware.content.library_client import Item
  from com.vmware.vapi.std.errors_client import Unauthenticated
  from com.vmware.vapi.std_client import DynamicID
  from com.vmware.vcenter.ovf_client import DiskProvisioningType, LibraryItem
  from com.vmware.vcenter.vm.hardware_client import Cpu, Memory
  from com.vmware.vcenter.vm_client import Power
  from com.vmware.vcenter_client import VM, Host, ResourcePool
  from vmware.vapi.vsphere.client import create_vsphere_client
  from ray.autoscaler._private.vsphere.utils import Constants, singleton_client
  from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME
label_desc: Use image node_id 19 for calling the VsphereSdkProvider obj's underlying member method code with example usage: obj.set_node_tags(vm_id, tags) without return types