A Gentex embedded controller must encode signed sensor values into fixed-width binary fields before transmission. Implement a function that converts an integer to its binary representation without using Python's bin() or formatting helpers.
The result must use two's-complement representation and contain exactly bits characters. Positive values are left-padded with zeroes. Negative values are represented by adding 2^bits before extracting bits.
Implement integer_to_binary(value, bits).
value, an integer in the signed range -2^(bits-1) <= value < 2^(bits-1), and bits, an integer from 1 through 32.bits characters, each character either '0' or '1'.bin(), format(), string conversion of the integer, or library-based base conversion.def integer_to_binary(value, bits):