code: def safe_rotate(
      img: np.ndarray,
      matrix: np.ndarray,
      interpolation: int,
      value: FillValueType = None,
      border_mode: int = cv2.BORDER_REFLECT_101,
  ) -> np.ndarray:
      h, w = img.shape[:2]
      warp_fn = _maybe_process_in_chunks(
          cv2.warpAffine,
          M=matrix,
          dsize=(w, h),
          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 25 for calling a global function with example usage: safe_rotate(img, matrix, interpolation, value, border_mode) and returns: warp_fn