code: def _adjust_attributes_of_max_pool(
      expand_size: int,
      kernel_size: Union[Sequence[int], int],
      stride: Union[Sequence[int], int],
      padding: Union[Sequence[int], int],
      dilation: Union[Sequence[int], int],
  ) -> Tuple[
      Sequence[int], Sequence[int], Sequence[int], Sequence[int]
  ]:
      """Adjust attributes of avg_pool to match ONNX specification."""
  
      if isinstance(dilation, int):
          dilation = [dilation] * expand_size
  
      if isinstance(kernel_size, int):
          kernel_shape = [kernel_size] * expand_size
      else:
          kernel_shape = kernel_size  # type: ignore[assignment]
  
      if isinstance(padding, int):
          pads = [padding] * expand_size * 2  # type: ignore[operator, assignment]
      elif len(padding) == 1:
          pads = padding * expand_size * 2  # type: ignore[operator, assignment]
      elif len(padding) == 2:
          # 2D padding
          pads = padding * 2  # type: ignore[operator, assignment]
      elif len(padding) == 3:
          # 3D padding
          pads = padding * 2  # type: ignore[operator, assignment]
      else:
          # When padding is already done for all dimensions,
          # we don't need to double it
          # eg: (1, 1, 1, 1, 1, 1)
          pads = padding  # type: ignore[assignment]
  
      if isinstance(stride, int):
          strides = [stride] * expand_size
      elif not stride:
          strides = kernel_shape
      else:
          strides = stride  # type: ignore[assignment]
  
      return (kernel_shape, strides, pads, dilation)
  
imports: from __future__ import annotations
  import functools
  import sys
  import warnings
  from typing import List, Optional, Sequence, Tuple, Union
  import torch
  import torch._C._onnx
  import torch.onnx
  from torch import _C
  from torch.onnx import _constants, _type_utils, errors, symbolic_helper, symbolic_opset9
  from torch.onnx._globals import GLOBALS
  from torch.onnx._internal import _beartype, jit_utils, registration
label_desc: Use image node_id 8 for calling a global function with example usage: _adjust_attributes_of_max_pool(expand_size, kernel_size, stride, padding, dilation) and returns: kernel_shape,  strides,  pads,  dilation