Utility function to fetch the transfer statistics for the last
        advanced transfer. Checking the stats appears to sync the
        controller. For details on the advanced transfer please refer
        to the documentation at
        http://diamondman.github.io/Adapt/cable_digilent_adept.html#bulk-requests

def _get_adv_trans_stats(self, cmd, return_tdo=False):
        """Utility function to fetch the transfer statistics for the last
        advanced transfer. Checking the stats appears to sync the
        controller. For details on the advanced transfer please refer
        to the documentation at
        http://diamondman.github.io/Adapt/cable_digilent_adept.html#bulk-requests

        """
        t = time()
        code, res = self.bulkCommand(b'\x03\x02%c\x00'%(0x80|cmd), 10)
        if self._scanchain and self._scanchain._print_statistics:
            print("GET STATS TIME", time()-t)#pragma: no cover
        if len(res) == 4:
            count = struct.unpack('<I', res)[0]
            return count
        elif len(res) == 8:
            written, read =  struct.unpack('<II', res)
            return written, read
        return res