code: def _get_cholesky_decomp(
      K_trtr_wo_noise, noise_var, handle_non_psd_kernels
  ):
      """Computes cholesky decomposition after checking how to handle non-psd kernels."""
      if handle_non_psd_kernels == "try_before_project":
          K_trtr_w_noise = K_trtr_wo_noise + noise_var * np.eye(
              K_trtr_wo_noise.shape[0]
          )
          try:
              # If the cholesky decomposition on the (noise added) matrix succeeds, return!
              L = stable_cholesky(
                  K_trtr_w_noise, add_to_diag_till_psd=False
              )
              return L
          except np.linalg.linalg.LinAlgError:
              # otherwise, project and return
              return _get_cholesky_decomp(
                  K_trtr_wo_noise, noise_var, "project_first"
              )
      elif handle_non_psd_kernels == "project_first":
          # project the Kernel (without noise) to the PSD cone and return
          K_trtr_wo_noise = project_symmetric_to_psd_cone(
              K_trtr_wo_noise
          )
          return _get_cholesky_decomp(
              K_trtr_wo_noise, noise_var, "guaranteed_psd"
          )
      elif handle_non_psd_kernels == "guaranteed_psd":
          K_trtr_w_noise = K_trtr_wo_noise + noise_var * np.eye(
              K_trtr_wo_noise.shape[0]
          )
          return stable_cholesky(K_trtr_w_noise)
      else:
          raise ValueError(
              "Unknown option for handle_non_psd_kernels: %s"
              % (handle_non_psd_kernels)
          )
  
imports: from __future__ import division
  from argparse import Namespace
  from itertools import product
  import sys
  import numpy
  from ..distributions.model import Model
  from ..distributions import continuous
  from ..distributions import discrete
  from ..utils.general_utils import stable_cholesky, draw_gaussian_samples, project_symmetric_to_psd_cone, solve_lower_triangular, solve_upper_triangular
  from ..utils.oper_utils import direct_ft_maximise, pdoo_maximise, random_maximise, random_sample_cts_dscr
  from ..utils.option_handler import get_option_specs, load_options
  from ..utils.reporters import get_reporter
label_desc: Use image node_id 3 for calling a global function with example usage: _get_cholesky_decomp(K_trtr_wo_noise, noise_var, handle_non_psd_kernels) and returns: L, _get_cholesky_decomp, _get_cholesky_decomp, stable_cholesky