Script to change alarm priority

Hi everybody,
I’m working with Ignition 8.1.3 on a list of tag in which everyone has an alarm associated with it. I’m trying to find a way to change the priority of the alarms using a dataset where i change the priorities and then use this values to over write them on the alarms inside the tags. the problem i don’t know how to force the value in the alarm to change.
Here some scripting i tried till now.
Thank you everybody in advance for your time and help

def saveAlarmList():   #---retreive the alarm list in the client tag and update the alarm priority in the tag browser
	
	from com.inductiveautomation.ignition.common.alarming import AlarmPriority
	
	dDataset = system.tag.read("[client]System/Alarms/AlarmPriority/dAlarms").value	#read the dataset to save
	#print dDataSet
	iRows = dDataset.getRowCount()		
	#print iRows
	
	for i in range(iRows):
		sPath = str(dDataset.getValueAt(i,2))  #get the path from the dataset
		print "sPath: %s" %sPath
		sPath = sPath.replace("prov:default:/tag:","[default]")   #change the first part of the path
		print "sPathConv: %s" %sPath
		sPath = sPath.split(":/alm:")[0]   #remove the last part of the path
		print "sPathCut: %s" %sPath
		sBasePath = sPath.split("Alarms/")[0]   #remove children folder
		sBasePath = sBasePath + "Alarms"   #add parent previously removed
		print "sBasePath: %s" %sBasePath
		sNewPriority = str(dDataset.getValueAt(i,1))
		
		currentConfig = system.tag.getConfiguration(sPath)   #get the tag configuration
		print "Config: ", currentConfig
		alarmList = currentConfig[0]['alarms']   #extract the alarms contained in the tag
		print "alarmList: ", alarmList
	
		for alarm in alarmList:
			alarm['name'] = alarmList[0]['name']
			print "alarmName: %s" %alarm['name']
			#sOldPriority = str(alarmList[0]['priority'])
			
			#if sOldPriority != sNewPriority:
			if sNewPriority == "Low":
				alarm['priority'] = AlarmPriority.Low
			if sNewPriority == "Medium":
				 alarm['priority'] = AlarmPriority.Medium
			if sNewPriority == "High":
				alarm['priority'] = AlarmPriority.High
			if sNewPriority == "Critical":
				alarm['priority'] = AlarmPriority.Critical	 				
			#else:
				#pass
			
		currentConfig[0]['alarms'] = alarm
		settings = "m"
		system.tag.configure(sBasePath,currentConfig,settings)