def UnitToValue(unit):
	"""Return the value of an unit."""

	if not unit or unit.upper() in frozenset(["ECU", "GCEU", "HRZ"]):
		return 1
	unit = unit[0].upper()
	if unit == "K":
		return 1024
	if unit == "M":
		return 1024 * 1024
	if unit == "G":
		return 1024 * 1024 * 1024
	raise Exception("Not valid unit: '%s'" % unit)