code: def get_neural_network_kernel(
      kernel_type, kernel_hyperparams, gp_cts_hps, gp_dscr_hps
  ):
      """Returns the kernel for the Neural Network."""
      # pylint: disable=too-many-branches
      if kernel_type == "otmann":
          # 1. Relative weights
          if kernel_hyperparams["otmann_kernel_type"] == "lpemd_sum":
              lp_emd_tradeoff = gp_cts_hps[0]
              lp_emd_alphas = [lp_emd_tradeoff, 1 - lp_emd_tradeoff]
              gp_cts_hps = gp_cts_hps[1:]
          # 2. Betas
          if kernel_hyperparams["otmann_dist_type"] in ["lp", "emd"]:
              betas = np.exp(
                  gp_cts_hps[
                      : kernel_hyperparams[
                          "otmann_num_mislabel_struct_coeffs"
                      ]
                  ]
              )
              gp_cts_hps = gp_cts_hps[
                  kernel_hyperparams[
                      "otmann_num_mislabel_struct_coeffs"
                  ] :
              ]
          elif kernel_hyperparams["otmann_dist_type"] == "lp-emd":
              betas = np.exp(
                  gp_cts_hps[
                      : 2
                      * kernel_hyperparams[
                          "otmann_num_mislabel_struct_coeffs"
                      ]
                  ]
              )
              gp_cts_hps = gp_cts_hps[
                  2
                  * kernel_hyperparams[
                      "otmann_num_mislabel_struct_coeffs"
                  ] :
              ]
          # 3 & 4. Mislabel/struct coeffs
          if kernel_hyperparams[
              "otmann_to_tune_mislabel_struct_coeffs"
          ]:
              mislabel_coeffs = [gp_cts_hps[0]]
              struct_coeffs = [gp_cts_hps[1]]
              gp_cts_hps = gp_cts_hps[2:]
          else:
              mislabel_coeffs = kernel_hyperparams[
                  "otmann_mislabel_coeffs"
              ]
              struct_coeffs = kernel_hyperparams["otmann_struct_coeffs"]
          # Determine the powers
          if kernel_hyperparams["otmann_dist_type"] == "lp":
              powers = [
                  kernel_hyperparams["otmann_lp_power"]
              ] * kernel_hyperparams[
                  "otmann_num_mislabel_struct_coeffs"
              ]
          elif kernel_hyperparams["otmann_dist_type"] == "emd":
              powers = [
                  kernel_hyperparams["otmann_emd_power"]
              ] * kernel_hyperparams[
                  "otmann_num_mislabel_struct_coeffs"
              ]
          elif kernel_hyperparams["otmann_dist_type"] == "lp-emd":
              powers = [
                  kernel_hyperparams["otmann_lp_power"],
                  kernel_hyperparams["otmann_emd_power"],
              ] * kernel_hyperparams[
                  "otmann_num_mislabel_struct_coeffs"
              ]
          else:
              raise ValueError(
                  "Unknown distance type: %s"
                  % (kernel_hyperparams["otmann_dist_type"])
              )
          # Check if there is a distance computer
          if (
              "otmann_distance_computer" in kernel_hyperparams
              and kernel_hyperparams["otmann_distance_computer"]
              is not None
          ):
              tp_comp = kernel_hyperparams["otmann_distance_computer"]
          else:
              from ..nn.otmann import (
                  get_otmann_distance_computer_from_args,
              )
  
              tp_comp = get_otmann_distance_computer_from_args(
                  kernel_hyperparams["nn_type"],
                  kernel_hyperparams["otmann_non_assignment_penalty"],
                  mislabel_coeffs,
                  struct_coeffs,
                  kernel_hyperparams["otmann_dist_type"],
              )
          # Now create the kernel
          from ..nn.otmann import DistProdNNKernel, DistSumNNKernel
  
          if kernel_hyperparams["otmann_kernel_type"] in [
              "lpemd_prod",
              "lp",
              "sum",
          ]:
              kern = DistProdNNKernel(tp_comp, betas, 1.0, powers)
          elif kernel_hyperparams["otmann_kernel_type"] in [
              "lpemd_sum"
          ]:
              kern = DistSumNNKernel(
                  tp_comp, lp_emd_alphas, betas, powers
              )
          else:
              raise ValueError(
                  "Unknown otmann_kernel_type: %s."
                  % (kernel_hyperparams["otmann_kernel_type"])
              )
      else:
          raise ValueError("Unknown kernel_type %s." % (kernel_type))
      # return
      return kern, gp_cts_hps, gp_dscr_hps
  
imports: from __future__ import print_function
  from argparse import Namespace
  import numpy
  from ..exd import domains
  from ..exd.cp_domain_utils import load_cp_domain_from_config_file
  from .None import gp_core, mf_gp
  from .euclidean_gp import get_euclidean_integral_gp_kernel_with_scale, prep_euclidean_integral_kernel_hyperparams
  from .kernel import CartesianProductKernel, HammingKernel
  from ..utils.general_utils import get_idxs_from_list_of_lists
  from ..utils.option_handler import get_option_specs, load_options
  from ..utils.reporters import get_reporter
label_desc: Use image node_id 15 for calling a global function with example usage: get_neural_network_kernel(kernel_type, kernel_hyperparams, gp_cts_hps, gp_dscr_hps) and returns: kern,  gp_cts_hps,  gp_dscr_hps