def int_to_binary(d, length=8):
	"""
	Binarize an integer d to a list of 0 and 1. Length of list is fixed by `length`
	"""
	d_bin = '{0:b}'.format(d)
	d_bin = (length - len(d_bin)) * '0' + d_bin  # Fill in with 0
	return [int(i) for i in d_bin]