def get_bitstring_bit(bitstring, bitnum):
	"""returns a single bit from within a bitstring, 0 = MSB"""
	bytepos = bitnum >> 3
	bitpos = 7 - (bitnum % 8)

	# we want to return 0 or 1.   I'll AND 2^bitpos and then divide by it
	return (bitstring[bytepos] & (2 ** bitpos)) >> bitpos