code: def fcs(bits):
  	'''
  	Append running bitwise FCS CRC checksum to end of generator
  	'''
  	fcs = FCS()
  	for bit in bits:
  		yield bit
  		fcs.update_bit(bit)
  
  #	test = bitarray()
  #	for byte in (digest & 0xff, digest >> 8):
  #		print byte
  #		for i in range(8):
  #			b = (byte >> i) & 1 == 1
  #			test.append(b)
  #			yield b
  
  	# append fcs digest to bit stream
  
  	# n.b. wire format is little-bit-endianness in addition to little-endian
  	digest = bitarray(endian="little")
  	digest.frombytes(fcs.digest())
  	for bit in digest:
  		yield bif fcs(bits):
  	'''
  	Append running bitwise FCS CRC checksum to end of generator
  	'''
  	fcs = FCS()
  	for bit in bits:
  		yield bit
  		fcs.update_bit(bit)
  
  #	test = bitarray()
  #	for byte in (digest & 0xff, digest >> 8):
  #		print byte
  #		for i in range(8):
  #			b = (byte >> i) & 1 == 1
  #			test.append(b)
  #			yield b
  
  	# append fcs digest to bit stream
  
  	# n.b. wire format is little-bit-endianness in addition to little-endian
  	digest = bitarray(endian="little")
  	digest.frombytes(fcs.digest())
  	for bit in digest:
  		yield bit
docs: Append running bitwise FCS CRC checksum to end of generator