def retrieve_tag_info(alignment, tag, type):
	"""
	extract a certain tag from the alignment line
	
	Arguments
	----------
	alignment: one line of the sam/bam file
	tag: a tag string
	type a tag type string
	
	Returns
	----------
	a string of the tag value
	
	"""
	for i in range(len(alignment)-1, 10, -1):
		key = "%s:%s:"%(tag, type)
		if (alignment[i].startswith(key)):
			return alignment[i][len(key):]
	return None