code: def _validate_max_pool_params(
      kernel, strides, padding, dilation, ceil_mode, dims, data_format
  ):
      if isinstance(kernel, int):
          kernel = (kernel,) * dims
      elif len(kernel) == 1:
          kernel = (kernel[0],) * dims
      elif len(kernel) not in [dims, dims + 2]:
          raise ValueError(
              "The kernel should be an integer, or a tuple of length"
              f" {list({1, dims, dims + 2})}"
          )
  
      if isinstance(strides, int):
          strides = (strides,) * dims
      elif len(strides) == 1:
          strides = (strides[0],) * dims
      elif len(strides) not in [dims, dims + 2]:
          raise ValueError(
              "The stride should be an integer, or a tuple of length"
              f" {list({1, dims, dims + 2})}"
          )
  
      if isinstance(padding, int):
          padding = [(padding,) * 2] * dims
      elif isinstance(padding, tuple) and len(padding) == 1:
          padding = [(padding[0],) * 2] * dims
      elif isinstance(padding, tuple) and len(padding) == dims:
          padding = [(padding[i],) * 2 for i in range(dims)]
      elif isinstance(padding, list) and len(padding) == dims:
          if not all(
              isinstance(p, tuple) and len(p) == 2 for p in padding
          ):
              raise ValueError(
                  "Explicit padding must be a list of tuple of two integers"
              )
      if isinstance(padding, str) and padding.upper() not in [
          "VALID",
          "SAME",
      ]:
          raise ValueError(
              f"Invalid padding arg {padding}Must be one of: 'VALID' or 'SAME'"
          )
  
      if isinstance(dilation, int):
          dilation = (dilation,) * dims
      elif len(dilation) == 1:
          dilation = (dilation[0],) * dims
      elif len(dilation) != dims:
          raise ValueError(
              f"Dilation must be an integer or a tuple of length {list({1, dims})}"
          )
      if min(dilation) < 1:
          raise ValueError("All values of `dilation` must be positive")
  
      # Other errors
      if (
          isinstance(padding, str)
          and (padding.upper() == "VALID")
          and ceil_mode
      ):
          raise ValueError(
              "When 'padding' is 'VALID', 'ceil_mode' must be False"
          )
      assert len(kernel) == len(
          strides
      ), f"len({kernel}) must equal len({strides})"
  
      ret = kernel, strides, padding, dilation
  
      # Account for dilation when padding > kernel/2. Not the case in torch by default.
      if len(dilation) < len(kernel):
          if data_format[:2] == "NC":
              dilation = [1, 1, *dilation]
          else:
              dilation = [1, *dilation, 1]
      elif len(dilation) > len(kernel):
          if data_format[:2] == "NC":
              kernel = [1, 1, *kernel]
          else:
              kernel = [1, *kernel, 1]
      new_kernel = tuple(
          dilation[i] * (kernel[i] - 1) + 1
          for i in range(1, len(kernel))
      )
      if isinstance(padding, list) and len(padding) == len(new_kernel):
          ivy.utils.assertions.check_kernel_padding_size(
              new_kernel, padding
          )
  
      return ret
  
imports: from typing import Optional, Tuple, Union, Sequence
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, handle_partial_mixed_function, inputs_to_ivy_arrays, to_native_arrays_and_back, inputs_to_native_shapes, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 20 for calling a global function with example usage: _validate_max_pool_params(kernel, strides, padding, dilation, ceil_mode, dims, data_format) and returns: ret