code: def get_nn_kernel_from_args(
      kernel_type, nn_type, kernel_hyperparams, tp_comp, dist_type
  ):
      """Returns the kernel."""
      if tp_comp is None:
          tp_comp = otmann.get_otmann_distance_computer_from_args(
              nn_type,
              kernel_hyperparams["non_assignment_penalty"],
              kernel_hyperparams["mislabel_coeffs"],
              kernel_hyperparams["struct_coeffs"],
              dist_type,
          )
      # Now construct the kernel.
      if kernel_type in ["lpemd_prod", "lp", "emd"]:
          return otmann.DistProdNNKernel(
              tp_comp,
              kernel_hyperparams["betas"],
              kernel_hyperparams["scale"],
              kernel_hyperparams["powers"],
          )
      elif kernel_type in ["lpemd_sum"]:
          return otmann.DistSumNNKernel(
              tp_comp,
              kernel_hyperparams["alphas"],
              kernel_hyperparams["betas"],
              kernel_hyperparams["powers"],
          )
      else:
          raise ValueError("Unknown kernel_type %s." % (kernel_type))
  
imports: import numpy
  from .None import otmann
  from ..gp import gp_core
  from ..utils.ancillary_utils import get_list_of_floats_as_str
  from ..utils.reporters import get_reporter
  from ..utils.option_handler import get_option_specs, load_options
label_desc: Use image node_id 1 for calling a global function with example usage: get_nn_kernel_from_args(kernel_type, nn_type, kernel_hyperparams, tp_comp, dist_type) and returns: otmann, otmann