from pathlib import Path


def _path_to_file_or_directory_to_path_iterator(path):
    """Convert a path to a file or directory to an iterator over paths."""
    path = Path(path)
    if path.is_dir():
        paths = list(path.rglob("*"))
    else:
        paths = [path]

    return paths