code: def _rejection_prior_sample(self, loglstar, num_trials=None):
      if num_trials is None:
          ncall = 0
          while True:
              x = self.sample_prior(1)
              logl, derived = self.loglike(x)
              ncall += 1
              if logl > loglstar:
                  break
      else:
          x = self.sample_prior(num_trials)
          logl, derived = self.loglike(x)
          ncall = num_trials / np.sum(logl > loglstar)
      return x, logl, derived, ncall
  
imports: from __future__ import print_function
  from __future__ import division
  import os
  import json
  import logging
  import time
  import torch
  import numpy
  from tqdm import tqdm
  import matplotlib.pyplot
  from nnest.trainer import Trainer
  from nnest.utils.evaluation import acceptance_rate, effective_sample_size, mean_jump_distance, gelman_rubin_diagnostic
  from nnest.utils.logger import create_logger, get_or_create_run_dir
label_desc: Use image node_id 7 for calling the Sampler obj's underlying member method code with example usage: obj._rejection_prior_sample(loglstar, num_trials) and returns: x,  logl,  derived,  ncall