from pathlib import Path


def _path_to_str(var):
    """Make sure var is a string or Path, return string representation."""
    if not isinstance(var, (Path, str)):
        raise ValueError("All path parameters must be either strings or "
                         "pathlib.Path objects. Found type %s." % type(var))
    else:
        return str(var)