Command controller to write TMS data (with constant TDI bit)
        to the physical scan chain. Optionally return TDO bits sent
        back from scan the chain.

        Args:
            data - bits to send over TMS line of scan chain (bitarray)
            return_tdo (bool) - return the devices bitarray response
            TDI (bool) - whether TDI should send a bitarray of all 0's
                         of same length as `data` (i.e False) or all 1's
                         (i.e. True)

        Returns:
            None by default or the (bitarray) response of the device
            after receiving data, if return_tdo is True.

        Usage:
            >>> from proteusisc import getAttachedControllers, bitarray
            >>> c = getAttachedControllers()[0]
            >>> c.jtag_enable()
            >>> c.write_tms_bits(bitarray("001011111"), return_tdo=True)
            >>> c.jtag_disable()

def write_tms_bits(self, data, return_tdo=False, TDI=False):
        """
        Command controller to write TMS data (with constant TDI bit)
        to the physical scan chain. Optionally return TDO bits sent
        back from scan the chain.

        Args:
            data - bits to send over TMS line of scan chain (bitarray)
            return_tdo (bool) - return the devices bitarray response
            TDI (bool) - whether TDI should send a bitarray of all 0's
                         of same length as `data` (i.e False) or all 1's
                         (i.e. True)

        Returns:
            None by default or the (bitarray) response of the device
            after receiving data, if return_tdo is True.

        Usage:
            >>> from proteusisc import getAttachedControllers, bitarray
            >>> c = getAttachedControllers()[0]
            >>> c.jtag_enable()
            >>> c.write_tms_bits(bitarray("001011111"), return_tdo=True)
            >>> c.jtag_disable()
        """
        self._check_jtag()
        self._update_scanchain(data)
        self.bulkCommandDefault(_BMSG_WRITE_TMS %
            (return_tdo, TDI, len(data).to_bytes(4, 'little')))
        self.bulkWriteData(build_byte_align_buff(data).tobytes()[::-1])
        tdo_bits = self._read_tdo(len(data)) if return_tdo else None
        self._get_adv_trans_stats(0x0B, return_tdo)
        return tdo_bits