<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _sample(self, nmr_samples, thinning=1, return_output=True):
 """Sample the given number of samples with the given thinning. If ``return_output`` we will return the samples, log likelihoods and log priors. If not, we will advance the state of the sampler without returning storing the samples. Args: nmr_samples (int):
 the number of iterations to advance the sampler thinning (int):
 the thinning to apply return_output (boolean):
 if we should return the output Returns: None or tuple: if ``return_output`` is True three ndarrays as (samples, log_likelihoods, log_priors) """

        kernel_data = self._get_kernel_data(nmr_samples, thinning, return_output)
        sample_func = self._get_compute_func(nmr_samples, thinning, return_output)
        sample_func.evaluate(kernel_data, self._nmr_problems,
                             use_local_reduction=all(env.is_gpu for env in self._cl_runtime_info.cl_environments),
                             cl_runtime_info=self._cl_runtime_info)
        self._sampling_index += nmr_samples * thinning
        if return_output:
            return (kernel_data['samples'].get_data(),
                    kernel_data['log_likelihoods'].get_data(),
                    kernel_data['log_priors'].get_data())