code: def gen_set_params(
      algo,
      pnames,
      schema_params,
      required_params,
      skip_params=None,
      ellipsis_param=None,
  ):
      if ellipsis_param:
          yield reformat_block(ellipsis_param, indent=2)
      if skip_params:
          yield "  # formally define variables that were excluded from function parameters"
          for pname in skip_params:
              yield "  %s <- NULL" % pname
      validate_frames = get_customizations_or_defaults_for(
          algo, "extensions.validate_frames"
      )
      if validate_frames:
          yield "  # Validate required training_frame first and other frame args: should be a valid key or an H2OFrame object"
          yield reformat_block(validate_frames, indent=2)
      else:
          frames = get_customizations_or_defaults_for(
              algo, "extensions.frame_params", []
          )
          if frames:
              yield "  # Validate required training_frame first and other frame args: should be a valid key or an H2OFrame object"
          for frame in frames:
              if frame in pnames:
                  required_val = str(frame in required_params).upper()
                  yield "  {frame} <- .validate.H2OFrame({frame}, required={required})".format(
                      frame=frame, required=required_val
                  )
  
      validate_required_params = get_customizations_or_defaults_for(
          algo, "extensions.validate_required_params"
      )
      if validate_required_params:
          yield ""
          yield "  # Validate other required args"
          yield reformat_block(validate_required_params, indent=2)
  
      validate_params = get_customizations_or_defaults_for(
          algo, "extensions.validate_params"
      )
      if validate_params:
          yield ""
          yield "  # Validate other args"
          yield reformat_block(validate_params, indent=2)
  
      yield ""
      yield "  # Build parameter list to send to model builder"
      yield "  parms <- list()"
      set_required_params = get_customizations_or_defaults_for(
          algo, "extensions.set_required_params"
      )
      if set_required_params:
          yield reformat_block(set_required_params, indent=2)
  
      skip_default_set_params = get_customizations_or_defaults_for(
          algo, "extensions.skip_default_set_params_for", []
      )
      yield ""
      for pname in schema_params:
          if pname in skip_default_set_params or (
              skip_params and pname in skip_params
          ):
              continue
  
          # leave the special handling of 'loss' param here for now as it is used by several algos
          if pname == "loss":
              yield "  if(!missing(loss)) {"
              yield '    if(loss == "MeanSquare") {'
              yield "      warning(\"Loss name 'MeanSquare' is deprecated; please use 'Quadratic' instead.\")"
              yield '      parms$loss <- "Quadratic"'
              yield "    } else "
              yield "      parms$loss <- loss"
              yield "  }"
          else:
              yield "  if (!missing(%s))" % pname
              yield "    parms$%s <- %s" % (pname, pname)
  
      set_params = get_customizations_or_defaults_for(
          algo, "extensions.set_params"
      )
      if set_params:
          yield ""
          yield reformat_block(set_params, indent=2)
  
file_path: h2o-3/h2o-bindings/bin/gen_R.py
imports: from collections import OrderedDict
  from copy import deepcopy
  from functools import partial
  import bindings
  from custom import get_customizations_for, reformat_block
label_desc: Use image node_id 3 for calling a global function with example usage: gen_set_params(algo, pnames, schema_params, required_params, skip_params, ellipsis_param) without return types