import pathlib


def make_dir(path: pathlib.Path) -> pathlib.Path:
    """
    Checks that path is a directory and then creates that directory if it doesn't exist
    Parameters
    ----------
    path: pathlib.Path
        Directory to check

    Returns
    -------
    pathlib.Path
        Path to directory
    """

    if path.is_file():
        raise IOError(f"{path} is a file - must pass a directory")

    if not path.exists():
        path.mkdir(parents=True)

    return path