def needle_positions_to_bytes(self, needle_positions):
bit = self.needle_positions<EOL>assert len(bit) == <NUM_LIT:2><EOL>max_length = len(needle_positions)<EOL>assert max_length == self.number_of_needles<EOL>result = []<EOL>for byte_index in range(<NUM_LIT:0>, max_length, <NUM_LIT:8>):<EOL><INDENT>byte = <NUM_LIT:0><EOL>for bit_index in range(<NUM_LIT:8>):<EOL><INDENT>index = byte_index + bit_index<EOL>if index >= max_length:<EOL><INDENT>break<EOL><DEDENT>needle_position = needle_positions[index]<EOL>if bit.index(needle_position) == <NUM_LIT:1>:<EOL><INDENT>byte |= <NUM_LIT:1> << bit_index<EOL><DEDENT><DEDENT>result.append(byte)<EOL>if byte_index >= max_length:<EOL><INDENT>break<EOL><DEDENT><DEDENT>result.extend(b"<STR_LIT:\x00>" * (<NUM_LIT> - len(result)))<EOL>return bytes(result)<EOL>
Convert the needle positions to the wire format.

        This conversion is used for :ref:`cnfline`.

        :param needle_positions: an iterable over :attr:`needle_positions` of
          length :attr:`number_of_needles`
        :rtype: bytes