def validate_target_frame(target_frame: int | None) -> int | None:
        """Validate target frame index.

        Args:
            target_frame (int | None): Input target frame index or ``None``.

        Returns:
            int | None: Validated target frame index or ``None``.

        Raises:
            TypeError: If ``target_frame`` is not an integer.
            ValueError: If target frame index is negative.

        Examples:
            >>> from anomalib.data.validators import VideoValidator
            >>> validated = VideoValidator.validate_target_frame(31)
            >>> print(validated)
            31
        """
        if target_frame is None:
            return None
        if not isinstance(target_frame, int):
            msg = f"Target frame must be an integer, got {type(target_frame)}."
            raise TypeError(msg)
        if target_frame < 0:
            msg = f"Target frame index must be non-negative, got {target_frame}."
            raise ValueError(msg)
        return target_frame
Validate target frame index.

        Args:
            target_frame (int | None): Input target frame index or ``None``.

        Returns:
            int | None: Validated target frame index or ``None``.

        Raises:
            TypeError: If ``target_frame`` is not an integer.
            ValueError: If target frame index is negative.

        Examples:
            >>> from anomalib.data.validators import VideoValidator
            >>> validated = VideoValidator.validate_target_frame(31)
            >>> print(validated)
            31
        
src/anomalib/data/validators/torch/video.py