def retrieve_XM_info(alignment, paired = True):
	"""
	extract the XM tag information from the alignment file
	
	Arguments
	----------
	sequences: one line of the sam/bam file
	paired: true if paired-end
	
	Returns
	----------
	a tuple of
	(1/2, barcode, probe_r1, probe_r2)
	or
	(barcode, probe_r1, probe_r2)
	"""
	for i in range(len(alignment)-1, 10, -1):
		if (alignment[i].startswith("XM:Z:")):
			info = alignment[i][5:].split(":")
			if (paired):
				if (len(info) != 4):
					raise ValueError("Unknown information column \"%s\"" % info)
			else:
				if (len(info) != 3):
					raise ValueError("Unknown information column \"%s\"" % info)
			return info
	return ""