def	tagsDict_toLineProtocolString(pTagsDict:dict):
	"""Converts a tags dictionnary to a valid LineProtocol string."""

	retval	=	''

	for lTagName in pTagsDict:
		lTagValue = pTagsDict[lTagName]

		# See https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/#special-characters
		if type(lTagValue) == str:
			lTagValue	=	lTagValue.replace(",", "\\,")
			lTagValue	=	lTagValue.replace("=", "\\=")
			lTagValue	=	lTagValue.replace(" ", "\\ ")

		if retval != '':
			retval	+= ','

		retval	+= lTagName
		retval	+= '='
		retval	+= str(lTagValue) # Tags are always strings

	return retval