def write_bits(self, *args):
        '''
        Write multiple bits in a single byte field. The bits will be written in
        little-endian order, but should be supplied in big endian order. Will
        raise ValueError when more than 8 arguments are supplied.

        write_bits(True, False) => 0x02
        '''
        # Would be nice to make this a bit smarter
        if len(args) > 8:
            raise ValueError("Can only write 8 bits at a time")

        self._output_buffer.append(chr(
            reduce(lambda x, y: xor(x, args[y] << y), xrange(len(args)), 0)))

        return self
Write multiple bits in a single byte field. The bits will be written in
        little-endian order, but should be supplied in big endian order. Will
        raise ValueError when more than 8 arguments are supplied.

        write_bits(True, False) => 0x02