code: def bbox_rot90(bbox, factor, rows, cols):
      
      if factor < 0 or factor > 3:
          raise ValueError('Parameter n must be in range [0;3]')
      x_min, y_min, x_max, y_max = bbox
      if factor == 1:
          bbox = [y_min, 1 - x_max, y_max, 1 - x_min]
      if factor == 2:
          bbox = [1 - x_max, 1 - y_max, 1 - x_min, 1 - y_min]
      if factor == 3:
          bbox = [1 - y_max, x_min, 1 - y_min, x_max]
      return bbox
docs: Rotates a bounding box by 90 degrees CCW (see np.rot90)
  
      Args:
          bbox (tuple): A tuple (x_min, y_min, x_max, y_max).
          factor (int): Number of CCW rotations. Must be in range [0;3] See np.rot90.
          rows (int): Image rows.
          cols (int): Image cols.