def get_fields(fields):
	"""
	From the last column of a GTF, return a dictionary mapping each value.

	Parameters:
		fields (str): The last column of a GTF

	Returns:
		attributes (dict): Dictionary created from fields.
	"""

	attributes = {}

	description = fields.strip()
	description = [x.strip() for x in description.split(";")]
	for pair in description:
		if pair == "": continue

		pair = pair.replace('"', '')
		key, val = pair.split()
		attributes[key] = val

	# put in placeholders for important attributes (such as gene_id) if they
	# are absent
	if 'gene_id' not in attributes:
		attributes['gene_id'] = 'NULL'

	return attributes