code: def random_sample_from_cp_domain_wrapper(num_pts, domain, reporter):
      """A wrapper to sample from a domain."""
      ret = []
      num_pts_to_request = num_pts
      num_tries = 0
      while len(ret) < num_pts:
          ret.extend(
              sample_from_cp_domain(
                  domain,
                  num_pts_to_request,
                  verbose_constraint_satisfaction=False,
              )
          )
          num_pts_to_request *= 2
          num_tries += 1
          if len(ret) == 0:
              if num_tries % 10 == 0:
                  error_msg = (
                      "Could not randomly sample from %s domain despite %d tries with "
                      + "up to %d candidates."
                  ) % (domain, num_tries, num_pts_to_request)
                  reporter.writeln(error_msg)
              if num_tries >= 51:
                  error_msg = (
                      "Could not randomly sample from domain %s despite %d tries with up"
                      + " to %d candidates. Quitting now"
                  ) % (domain, num_tries, num_pts_to_request)
                  raise ValueError(error_msg)
      return ret[:num_pts]
  
imports: from argparse import Namespace
  import numpy
  from ..exd.cp_domain_utils import get_processed_func_from_raw_func_for_cp_domain, load_cp_domain_from_config_file
  from ..exd import domains
  from ..exd.exd_utils import get_euclidean_initial_qinfos, get_cp_domain_initial_qinfos
  from ..exd.exd_core import mf_exd_args
  from ..exd.experiment_caller import CPFunctionCaller
  from ..exd.cp_domain_utils import sample_from_cp_domain
  from ..exd.worker_manager import SyntheticWorkerManager
  from .blackbox_optimiser import BlackboxOptimiser, blackbox_opt_args, CalledMFOptimiserWithSFCaller
  from ..utils.option_handler import load_options
  from ..utils.reporters import get_reporter
  from ..utils.general_utils import map_to_bounds
label_desc: Use image node_id 1 for calling a global function with example usage: random_sample_from_cp_domain_wrapper(num_pts, domain, reporter) and returns: ret