def SliceBits(num, msb, lsb=None):
	"""
	Slice bits from an integer from the msb to the lsb (inclusive) and 0-indexed
	If no lsb is provided it will only grab the one bit at the msb specified
	num - the number
	msb - the most significant bit to keep
	lsb - the least significant bit to keep
	ex. SliceBits(0xF000, 15, 12) = 0xF
	ex. SliceBits(0x7800, 14, 11) = 0xF
	"""
	width = (msb-lsb+1) if lsb is not None else 1
	return (((2**(width))-1 << msb-width+1) & num) >> msb-width+1