def _check_and_convert_path(path: str | Path) -> Path:
    """Check and convert input path to pathlib object.

    Args:
        path: Input path as string or Path object

    Returns:
        Path object of the input path

    Example:
        >>> path = _check_and_convert_path("./datasets/example.png")
        >>> isinstance(path, Path)
        True
    """
    if not isinstance(path, Path):
        path = Path(path)
    return path
Check and convert input path to pathlib object.

    Args:
        path: Input path as string or Path object

    Returns:
        Path object of the input path

    Example:
        >>> path = _check_and_convert_path("./datasets/example.png")
        >>> isinstance(path, Path)
        True
    
src/anomalib/data/utils/path.py