code: def get_euclidean_integral_gp_kernel_with_scale(
      kernel_type,
      scale,
      kernel_hyperparams,
      gp_cts_hps,
      gp_dscr_hps,
      use_same_bandwidth,
      add_gp_groupings=None,
      esp_kernel_type=None,
  ):
      """A method to parse the GP kernel from hyper-parameters. Assumes the scale is
      not part of the hyper-parameters but given as an argument."""
      # pylint: disable=too-many-branches
      # pylint: disable=too-many-statements
      dim = kernel_hyperparams["dim"]
      # For the additive ones ---------------------
      esp_order = None
      if kernel_type == "esp":
          if "esp_order" in kernel_hyperparams:
              esp_order = kernel_hyperparams["esp_order"]
          else:
              esp_order = gp_dscr_hps[-1]
              gp_dscr_hps = gp_dscr_hps[:-1]
      is_additive = False
      if add_gp_groupings is None:
          add_gp_groupings = [list(range(dim))]
          grp_scale = scale
      elif esp_order is None:
          is_additive = True
          grp_scale = 1.0
      # Extract features and create a placeholder for the kernel constructors.
      # Some common functionality for the se, matern and poly kernels.
      if kernel_type in ["se", "matern", "poly"]:
          if use_same_bandwidth:
              ke_dim_bandwidths = [np.exp(gp_cts_hps[0])] * dim
              gp_cts_hps = gp_cts_hps[1:]
          else:
              ke_dim_bandwidths = np.exp(gp_cts_hps[0:dim])
              gp_cts_hps = gp_cts_hps[dim:]
      elif kernel_type in ["esp"]:
          if use_same_bandwidth:
              esp_dim_bandwidths = np.exp(gp_cts_hps[0:dim])
              gp_cts_hps = gp_cts_hps[dim:]
          else:
              esp_dim_bandwidths = np.exp(gp_cts_hps[0 : dim * dim])
              gp_cts_hps = gp_cts_hps[dim * dim :]
      # Now iterate through the kernels for the rest of the parameters.
      if kernel_type == "se":
          grp_kernels = [
              gp_kernel.SEKernel(
                  dim=len(grp),
                  scale=grp_scale,
                  dim_bandwidths=get_sublist_from_indices(
                      ke_dim_bandwidths, grp
                  ),
              )
              for grp in add_gp_groupings
          ]
      elif kernel_type == "matern":
          if (
              "nu" not in kernel_hyperparams
              or kernel_hyperparams["nu"] < 0
          ):
              matern_nu = gp_dscr_hps[0]
              gp_dscr_hps = gp_dscr_hps[1:]
          else:
              matern_nu = kernel_hyperparams["nu"]
          grp_kernels = [
              gp_kernel.MaternKernel(
                  dim=len(grp),
                  nu=matern_nu,
                  scale=grp_scale,
                  dim_bandwidths=get_sublist_from_indices(
                      ke_dim_bandwidths, grp
                  ),
              )
              for grp in add_gp_groupings
          ]
      elif kernel_type == "poly":
          if (
              "order" not in kernel_hyperparams
              or kernel_hyperparams["order"] < 0
          ):
              poly_order = gp_dscr_hps[0]
              gp_dscr_hps = gp_dscr_hps[1:]
          else:
              poly_order = kernel_hyperparams["order"]
          grp_kernels = [
              gp_kernel.PolyKernel(
                  dim=len(grp),
                  order=poly_order,
                  scale=grp_scale,
                  dim_scalings=get_sublist_from_indices(
                      ke_dim_bandwidths, grp
                  ),
              )
              for grp in add_gp_groupings
          ]
      elif kernel_type == "expdecay":
          exp_decay_offset = np.exp(gp_cts_hps[0])
          exp_decay_powers = np.exp(gp_cts_hps[1 : dim + 1])
          gp_cts_hps = gp_cts_hps[dim + 1 :]
          grp_kernels = [
              gp_kernel.ExpDecayKernel(
                  dim=len(grp),
                  scale=grp_scale,
                  offset=exp_decay_offset,
                  powers=exp_decay_powers,
              )
              for grp in add_gp_groupings
          ]
      elif kernel_type == "esp":
          if not np.isscalar(esp_order):
              esp_order = np.asscalar(esp_order)
          if esp_kernel_type == "se":
              grp_kernels = [
                  gp_kernel.ESPKernelSE(
                      dim=dim,
                      scale=scale,
                      order=int(esp_order),
                      dim_bandwidths=esp_dim_bandwidths,
                  )
              ]
          elif esp_kernel_type == "matern":
              if "esp_matern_nu" not in kernel_hyperparams:
                  matern_nu = [gp_dscr_hps[0]] * dim
                  gp_dscr_hps = gp_dscr_hps[1:]
              else:
                  matern_nu = [
                      kernel_hyperparams["esp_matern_nu"]
                  ] * dim
              grp_kernels = [
                  gp_kernel.ESPKernelMatern(
                      dim=dim,
                      nu=matern_nu,
                      scale=scale,
                      order=int(esp_order),
                      dim_bandwidths=esp_dim_bandwidths,
                  )
              ]
      else:
          raise Exception("Unknown kernel type %s!" % (kernel_type))
      if is_additive:
          euc_kernel = gp_kernel.AdditiveKernel(
              scale=scale,
              kernel_list=grp_kernels,
              groupings=add_gp_groupings,
          )
      else:
          euc_kernel = grp_kernels[0]
      return euc_kernel, gp_cts_hps, gp_dscr_hps
  
imports: from __future__ import division
  from argparse import Namespace
  import numpy
  from .None import gp_core, mf_gp
  from .None import kernel
  from ..utils.ancillary_utils import get_list_of_floats_as_str
  from ..utils.general_utils import get_sublist_from_indices, map_to_bounds
  from ..utils.option_handler import get_option_specs, load_options
  from ..utils.oper_utils import random_sample_from_discrete_domain
  from ..utils.reporters import get_reporter
label_desc: Use image node_id 5 for calling a global function with example usage: get_euclidean_integral_gp_kernel_with_scale(kernel_type, scale, kernel_hyperparams, gp_cts_hps, gp_dscr_hps, use_same_bandwidth, add_gp_groupings, esp_kernel_type) and returns: euc_kernel,  gp_cts_hps,  gp_dscr_hps