def parse_result(self, data):
        """
        Parse result of L{pyhsm.defines.YSM_BUFFER_LOAD} command.

        @return: Number of bytes now in the YubiHSM internal buffer.
        @rtype: integer

        @raise pyhsm.exception.YHSM_Error: Unexpected number of bytes were loaded
        """
        # typedef struct {
        #   uint8_t numBytes;                   // Number of bytes in buffer now
        # } YSM_BUFFER_LOAD_RESP;
        count = ord(data[0])
        if self.offset == 0:
            # if offset was 0, the buffer was reset and
            # we can verify the length returned
            if count != self.data_len:
                raise pyhsm.exception.YHSM_Error("Incorrect number of bytes in buffer (got %i, expected %i)" \
                                               % (self.data_len, count))
        return count
dataset/ETHPy150Open Yubico/python-pyhsm/pyhsm/buffer_cmd.py/YHSM_Cmd_Buffer_Load.parse_result/original