def to_bin(data, width):
data_str = bin(data & (<NUM_LIT:2>**width-<NUM_LIT:1>))[<NUM_LIT:2>:].zfill(width)<EOL>return [int(x) for x in tuple(data_str)]<EOL>
Convert an unsigned integer to a numpy binary array with the first
element the MSB and the last element the LSB.