(path: types.PathLike)
Coerce ``path`` to a ``pathlib.Path``.

    Args:
        path

    Returns:
        :class:`pathlib.Path`
Coerce ``path`` to a ``pathlib.Path``.
Coerce path to a pathlib . Path .
def to_path(path: types.PathLike) -> pathlib.Path:
    """
    Coerce ``path`` to a ``pathlib.Path``.

    Args:
        path

    Returns:
        :class:`pathlib.Path`
    """
    if isinstance(path, str):
        return pathlib.Path(path)
    elif isinstance(path, pathlib.Path):
        return path
    else:
        raise TypeError(
            errors_.type_invalid_msg("path", type(path), Union[str, pathlib.Path])
        )
def to_path ( path : types . PathLike ) -> pathlib . Path : if isinstance ( path , str ) : return pathlib . Path ( path ) elif isinstance ( path , pathlib . Path ) : return path else : raise TypeError ( errors_ . type_invalid_msg ( "path" , type ( path ) , Union [ str , pathlib . Path ] ) )