code: def rotate(
      img: np.ndarray,
      angle: float,
      interpolation: int = cv2.INTER_LINEAR,
      border_mode: int = cv2.BORDER_REFLECT_101,
      value: Optional[ImageColorType] = None,
  ):
      height, width = img.shape[:2]
      # for images we use additional shifts of (0.5, 0.5) as otherwise
      # we get an ugly black border for 90deg rotations
      matrix = cv2.getRotationMatrix2D(
          (width / 2 - 0.5, height / 2 - 0.5), angle, 1.0
      )
  
      warp_fn = _maybe_process_in_chunks(
          cv2.warpAffine,
          M=matrix,
          dsize=(width, height),
          flags=interpolation,
          borderMode=border_mode,
          borderValue=value,
      )
      return warp_fn(img)
  
imports: import math
  from typing import List, Optional, Sequence, Tuple, Union
  import cv2
  import numpy
  import skimage.transform
  from scipy.ndimage import gaussian_filter
  from albumentations.augmentations.utils import _maybe_process_in_chunks, angle_2pi_range, clipped, preserve_channel_dim, preserve_shape
  from ...None import random_utils
  from ...core.bbox_utils import denormalize_bbox, normalize_bbox
  from ...core.transforms_interface import BoxInternalType, FillValueType, ImageColorType, KeypointInternalType
label_desc: Use image node_id 3 for calling a global function with example usage: rotate(img, angle, interpolation, border_mode, value) and returns: warp_fn