get group's data block bytes

def _load_data(self, group, record_offset=0, record_count=None):
        """ get group's data block bytes """
        offset = 0
        has_yielded = False
        _count = record_count
        data_group = group.data_group
        channel_group = group.channel_group

        if group.data_location == v4c.LOCATION_ORIGINAL_FILE:
            stream = self._file
        else:
            stream = self._tempfile

        read = stream.read
        seek = stream.seek

        samples_size = (
            channel_group.samples_byte_nr + channel_group.invalidation_bytes_nr
        )

        record_offset *= samples_size

        finished = False
        if record_count is not None:
            record_count *= samples_size

        if not samples_size:
            yield b"", offset, _count
        else:

            if self._read_fragment_size:
                split_size = self._read_fragment_size // samples_size
                split_size *= samples_size
            else:
                channels_nr = len(group.channels)

                y_axis = CONVERT

                idx = searchsorted(CHANNEL_COUNT, channels_nr, side="right") - 1
                if idx < 0:
                    idx = 0
                split_size = y_axis[idx]

                split_size = split_size // samples_size
                split_size *= samples_size

            if split_size == 0:
                split_size = samples_size

            if not group.sorted:
                cg_size = group.record_size
                record_id = channel_group.record_id
                record_id_nr = data_group.record_id_len

                if record_id_nr == 1:
                    _unpack_stuct = UINT8_u
                elif record_id_nr == 2:
                    _unpack_stuct = UINT16_u
                elif record_id_nr == 4:
                    _unpack_stuct = UINT32_u
                elif record_id_nr == 8:
                    _unpack_stuct = UINT64_u
                else:
                    message = f"invalid record id size {record_id_nr}"
                    raise MdfException(message)

            blocks = iter(group.data_blocks)

            if group.data_blocks:

                cur_size = 0
                data = []

                while True:
                    try:
                        info = next(blocks)
                        address, size, block_size, block_type, param = (
                            info.address,
                            info.raw_size,
                            info.size,
                            info.block_type,
                            info.param,
                        )
                        current_address = address
                    except StopIteration:
                        break

                    if group.sorted:
                        if offset + size < record_offset + 1:
                            offset += size
                            continue

                    seek(address)
                    new_data = read(block_size)
                    if block_type == v4c.DZ_BLOCK_DEFLATE:
                        new_data = decompress(new_data, 0, size)
                    elif block_type == v4c.DZ_BLOCK_TRANSPOSED:
                        new_data = decompress(new_data, 0, size)
                        cols = param
                        lines = size // cols

                        nd = fromstring(new_data[: lines * cols], dtype=uint8)
                        nd = nd.reshape((cols, lines))
                        new_data = nd.T.tostring() + new_data[lines * cols :]

                    if not group.sorted:
                        rec_data = []

                        i = 0
                        size = len(new_data)
                        while i < size:
                            rec_id, = _unpack_stuct(new_data[i : i + record_id_nr])
                            # skip record id
                            i += record_id_nr
                            rec_size = cg_size[rec_id]
                            if rec_size:
                                endpoint = i + rec_size
                                if rec_id == record_id:
                                    rec_data.append(new_data[i : endpoint])
                                i = endpoint
                            else:
                                rec_size, = UINT32_u(new_data[i : i + 4])
                                endpoint = i + rec_size + 4
                                if rec_id == record_id:
                                    rec_data.append(new_data[i : endpoint])
                                i = endpoint
                        new_data = b"".join(rec_data)

                        size = len(new_data)

                    if offset < record_offset:
                        delta = record_offset - offset
                        new_data = new_data[delta:]
                        size -= delta
                        offset = record_offset

                    while size >= split_size - cur_size:
                        if data:
                            data.append(new_data[:split_size - cur_size])
                            new_data = new_data[split_size - cur_size:]
                            data_ = b"".join(data)
                            if record_count is not None:
                                yield data_[:record_count], offset, _count
                                has_yielded = True
                                record_count -= len(data_)
                                if record_count <= 0:
                                    finished = True
                                    break
                            else:
                                yield data_, offset, _count
                                has_yielded = True
                            current_address += split_size - cur_size
                        else:
                            data_, new_data = new_data[:split_size], new_data[split_size:]
                            if record_count is not None:
                                yield data_[:record_count], offset, _count
                                has_yielded = True
                                record_count -= len(data_)
                                if record_count <= 0:
                                    finished = True
                                    break
                            else:
                                yield data_, offset, _count
                                has_yielded = True
                            current_address += split_size
                        offset += split_size

                        size -= split_size - cur_size
                        data = []
                        cur_size = 0

                    if finished:
                        data = []
                        break

                    if size:
                        data.append(new_data)
                        cur_size += size
                if data:
                    data_ = b"".join(data)
                    if record_count is not None:
                        yield data_[:record_count], offset, _count
                        has_yielded = True
                        record_count -= len(data_)
                    else:
                        yield data_, offset, _count
                        has_yielded = True

                if not has_yielded:
                    yield b"", 0, _count
            else:
                yield b"", offset, _count