code: def bbox_rotate(
      bbox: BoxInternalType,
      angle: float,
      method: str,
      rows: int,
      cols: int,
  ) -> BoxInternalType:
      """Rotates a bounding box by angle degrees.
  
      Args:
          bbox: A bounding box `(x_min, y_min, x_max, y_max)`.
          angle: Angle of rotation in degrees.
          method: Rotation method used. Should be one of: "largest_box", "ellipse". Default: "largest_box".
          rows: Image rows.
          cols: Image cols.
  
      Returns:
          A bounding box `(x_min, y_min, x_max, y_max)`.
  
      References:
          https://arxiv.org/abs/2109.13488
  
      """
      x_min, y_min, x_max, y_max = bbox[:4]
      scale = cols / float(rows)
      if method == "largest_box":
          x = np.array([x_min, x_max, x_max, x_min]) - 0.5
          y = np.array([y_min, y_min, y_max, y_max]) - 0.5
      elif method == "ellipse":
          w = (x_max - x_min) / 2
          h = (y_max - y_min) / 2
          data = np.arange(0, 360, dtype=np.float32)
          x = w * np.sin(np.radians(data)) + (w + x_min - 0.5)
          y = h * np.cos(np.radians(data)) + (h + y_min - 0.5)
      else:
          raise ValueError(
              f"Method {method} is not a valid rotation method."
          )
      angle = np.deg2rad(angle)
      x_t = (np.cos(angle) * x * scale + np.sin(angle) * y) / scale
      y_t = -np.sin(angle) * x * scale + np.cos(angle) * y
      x_t = x_t + 0.5
      y_t = y_t + 0.5
  
      x_min, x_max = min(x_t), max(x_t)
      y_min, y_max = min(y_t), max(y_t)
  
      return x_min, y_min, x_max, y_max
  
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 4 for calling a global function with example usage: bbox_rotate(bbox, angle, method, rows, cols) and returns: x_min,  y_min,  x_max,  y_max