code: def get_pascal_kernel_2d(
      kernel_size: tuple[int, int] | int,
      norm: bool = True,
      *,
      device: Optional[Device] = None,
      dtype: Optional[Dtype] = None,
  ) -> Tensor:
      """Generate pascal filter kernel by kernel size.
  
      Args:
          kernel_size: height and width of the kernel.
          norm: if to normalize the kernel or not. Default: True.
          device: tensor device desired to create the kernel
          dtype: tensor dtype desired to create the kernel
  
      Returns:
          if kernel_size is an integer the kernel will be shaped as :math:`(kernel_size, kernel_size)`
          otherwise the kernel will be shaped as :math: `kernel_size`
  
      Examples:
      >>> get_pascal_kernel_2d(1)
      tensor([[1.]])
      >>> get_pascal_kernel_2d(4)
      tensor([[0.0156, 0.0469, 0.0469, 0.0156],
              [0.0469, 0.1406, 0.1406, 0.0469],
              [0.0469, 0.1406, 0.1406, 0.0469],
              [0.0156, 0.0469, 0.0469, 0.0156]])
      >>> get_pascal_kernel_2d(4, norm=False)
      tensor([[1., 3., 3., 1.],
              [3., 9., 9., 3.],
              [3., 9., 9., 3.],
              [1., 3., 3., 1.]])
      """
      ky, kx = _unpack_2d_ks(kernel_size)
      ax = get_pascal_kernel_1d(kx, device=device, dtype=dtype)
      ay = get_pascal_kernel_1d(ky, device=device, dtype=dtype)
  
      filt = ay[:, None] * ax[None, :]
      if norm:
          filt = filt / torch.sum(filt)
      return filt
  
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 34 for calling a global function with example usage: get_pascal_kernel_2d(kernel_size, norm) and returns: filt