code: def boca(select_pt_func, mfgp, anc_data, func_caller):
      """Uses the BOCA strategy to pick the next point and fidelity as described in
      Kandasamy et al. 2017 "Multi-fidelity Bayesian Optimisation with Continuous
      Approximations (https://arxiv.org/pdf/1703.06240.pdf).
      We have some additional heuristics implemented as described in the appendix.
      """
      if anc_data.curr_acq == "add_ucb":
          next_eval_point = asy_add_ucb_for_boca(
              mfgp, func_caller.fidel_to_opt, anc_data
          )
      else:
          fidel_to_opt_gp = _get_fidel_to_opt_gp(
              mfgp, func_caller.fidel_to_opt
          )
          next_eval_point = select_pt_func(fidel_to_opt_gp, anc_data)
      (
          candidate_fidels,
          cost_ratios,
      ) = func_caller.get_candidate_fidels_and_cost_ratios(
          next_eval_point, filter_by_cost=True
      )
      num_candidates = len(candidate_fidels)
      cost_ratios = np.array(cost_ratios)
      sqrt_cost_ratios = np.sqrt(cost_ratios)
      information_gaps = np.array(
          func_caller.get_information_gap(candidate_fidels)
      )
      _, cand_fidel_stds = mfgp.eval_at_fidel(
          candidate_fidels,
          [next_eval_point] * num_candidates,
          uncert_form="std",
      )
      cand_fidel_stds = cand_fidel_stds / np.sqrt(
          mfgp.kernel.hyperparams["scale"]
      )
      std_thresholds = (
          anc_data.boca_thresh_coeff
          * anc_data.y_range
          * sqrt_cost_ratios
          * information_gaps
      )
      high_std_idxs = cand_fidel_stds > std_thresholds
      qualifying_idxs = np.where(high_std_idxs)[0]
      if len(qualifying_idxs) == 0:
          next_eval_fidel = func_caller.fidel_to_opt
      else:
          # If the cost_ratio is larger than a threshold, then just evaluate at fidel to opt.
          qualifying_fidels = [
              candidate_fidels[idx] for idx in qualifying_idxs
          ]
          # boca 0
          qualifying_sqrt_cost_ratios = sqrt_cost_ratios[
              qualifying_idxs
          ]
          qualifying_cost_ratios = cost_ratios[qualifying_idxs]
          next_eval_fidel_idx = qualifying_sqrt_cost_ratios.argmin()
          # Select the fidel
          if (
              qualifying_cost_ratios[next_eval_fidel_idx]
              > anc_data.boca_max_low_fidel_cost_ratio
          ):
              next_eval_fidel = func_caller.fidel_to_opt
          else:
              next_eval_fidel = qualifying_fidels[next_eval_fidel_idx]
      return next_eval_fidel, next_eval_point
  
imports: from __future__ import division
  from argparse import Namespace
  from copy import copy
  import numpy
  from scipy.stats import norm
  from ..utils.general_utils import solve_lower_triangular
  from ..gp.gp_core import get_post_covar_from_raw_covar
  from ..exd.domains import EuclideanDomain
  from ..exd.exd_utils import maximise_with_method
label_desc: Use image node_id 29 for calling a global function with example usage: boca(select_pt_func, mfgp, anc_data, func_caller) and returns: next_eval_fidel,  next_eval_point