code: def _unpack_2d_ks(
      kernel_size: tuple[int, int] | int
  ) -> tuple[int, int]:
      if isinstance(kernel_size, int):
          ky = kx = kernel_size
      else:
          KORNIA_CHECK(
              len(kernel_size) == 2,
              "2D Kernel size should have a length of 2.",
          )
          ky, kx = kernel_size
  
      ky = int(ky)
      kx = int(kx)
  
      return (ky, kx)
  
imports: from __future__ import annotations
  import math
  from math import sqrt
  from typing import Any, Optional
  import torch
  from kornia.core import Device, Dtype, Tensor, concatenate, cos, stack, tensor, where, zeros, zeros_like
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
  from kornia.utils import deprecated
label_desc: Use image node_id 2 for calling a global function with example usage: _unpack_2d_ks(kernel_size) and returns: ky,  kx