def METHOD_NAME(self, mask):
    if len(mask.shape) == 2:
        height, width = mask.shape
    else:
        height, width, _ = mask.shape
    width_diff = self.dst_width - width
    offset_crop_width = max(-width_diff // 2, 0)
    offset_pad_width = max(width_diff // 2, 0)
    height_diff = self.dst_height - height
    offset_crop_height = max(-height_diff // 2, 0)
    offset_pad_height = max(height_diff // 2, 0)
    cropped, _ = CropOrPad.crop_to_bounding_box(
        mask, offset_crop_height, offset_crop_width, min(self.dst_height, height), min(self.dst_width, width))
    resized, _ = CropOrPad.pad_to_bounding_box(
        cropped, offset_pad_height, offset_pad_width, self.dst_height, self.dst_width
    )
    return resized