code: def convert_Pad(
      func, opset_version, input_names, output_names, context
  ):
      if func.mode not in ["constant", "reflect", "edge"]:
          raise ValueError(
              "{} mode is not supported in ONNX's Pad operation".format(
                  func.mode
              )
          )
  
      pad_begin = []
      pad_end = []
      pad_bw = func.pad_bw
      if pad_bw.ndim == 1:
          pad_bw = np.tile(pad_bw, (len(func.inputs[0].shape), 1))
      for pp in pad_bw.tolist():
          pad_begin.append(pp[0])
          pad_end.append(pp[1])
      pad = pad_begin + pad_end
  
      constant_value = func.keywords.get("constant_values", None)
      if constant_value is not None:
          # 'constant_values' only accepts int or array-like on Chainer
          if (
              not isinstance(constant_value, int)
              and len(constant_value) > 1
          ):
              raise ValueError(
                  "ONNX doesn't support multiple constant values for Pad "
                  "operation"
              )
          elif not isinstance(constant_value, int):
              constant_value = float(constant_value[0])
          else:
              constant_value = float(constant_value)
  
      if opset_version == 1:
          kwargs = {
              "mode": func.mode,
              "paddings": pad,
          }
          if constant_value is not None:
              kwargs["value"] = constant_value
      elif opset_version == 2:
          kwargs = {
              "mode": func.mode,
              "pads": pad,
          }
          if constant_value is not None:
              kwargs["value"] = constant_value
      elif opset_version == 11:
          pads_name = context.add_const(
              np.array(pad, dtype=np.int64), "pads"
          )
          input_names.append(pads_name)
          if constant_value is not None:
              constant_value_name = context.add_const(
                  np.array(constant_value, dtype=np.float32),
                  "constant_value",
              )
              input_names.append(constant_value_name)
          kwargs = {"mode": func.mode}
  
      return (
          onnx_helper.make_node(
              "Pad", input_names, output_names, **kwargs
          ),
      )
  
imports: import warnings
  import chainer
  import numpy
  import onnx
  from onnx.mapping import NP_TYPE_TO_TENSOR_TYPE
  from onnx_chainer.functions.opset_version import support
  from onnx_chainer import onnx_helper
label_desc: Use image node_id 9 for calling a global function with example usage: convert_Pad(func, opset_version, input_names, output_names, context) and returns: onnx_helper