from typing import Union
from pathlib import Path


def is_dir(path: Union[str, Path]) -> bool:
    """Check if the given path is a directory

    :param path: path to be checked
    """
    if isinstance(path, str):
        path = Path(path)

    if path.exists():
        return path.is_dir()
    else:
        return str(path).endswith("/")