code: def get_otmann_kernel_from_params(
      kernel_type,  # The kernel type, should be 'sum' or 'product'
      all_layer_labels,
      label_mismatch_penalty,  # mandatory distance args
      non_assignment_penalty,
      structural_penalty_groups,
      path_length_types,
      mislabel_coeffs,
      struct_coeffs,
      dist_type,
      betas,
      scales,  # mandatory kernel args
      connectivity_diff_cost_function=DFLT_CONN_COST_FUNC,  # optional dist args
      powers=DFLT_KERN_DIST_POWERS,
  ):  # optional kernel args
      # pylint: disable=too-many-arguments
      """Generates a OTMANNKernel from all parameters for the distance computer
      and the kernel.
      scales should be a scalar if kernel_type is 'prod' and a list if 'sum'.
      """
      tp_comp = OTMANNDistanceComputer(
          all_layer_labels,
          label_mismatch_penalty,
          non_assignment_penalty,
          structural_penalty_groups,
          path_length_types,
          dflt_mislabel_coeffs=mislabel_coeffs,
          dflt_struct_coeffs=struct_coeffs,
          dflt_dist_type=dist_type,
          connectivity_diff_cost_function=connectivity_diff_cost_function,
      )
      if kernel_type == "prod":
          return DistProdNNKernel(tp_comp, betas, scales, powers)
      elif kernel_type == "sum":
          return DistSumNNKernel(tp_comp, scales, betas, powers)
  
imports: import numpy
  from .None import neural_network
  from ..gp.kernel import ExpSumOfDistsKernel, SumOfExpSumOfDistsKernel
  from ..utils.oper_utils import opt_transport
label_desc: Use image node_id 6 for calling a global function with example usage: get_otmann_kernel_from_params(kernel_type, all_layer_labels, label_mismatch_penalty, non_assignment_penalty, structural_penalty_groups, path_length_types, mislabel_coeffs, struct_coeffs, dist_type, betas, scales, connectivity_diff_cost_function, powers) and returns: DistProdNNKernel, DistSumNNKernel