from typing import Union
from pathlib import Path


def path_to_pathlib(path: Union[Path, str]) -> Path:
    """If a string is passed to the function, it turns into Path from pathlib.

    Args:
      path: string of path or Path from pathlib.

    Returns:
      Path from pathlib.
    """
    return Path(path) if isinstance(path, str) else path