from pathlib import Path
from datetime import datetime


def unique_path(parent: Path, stem: str, suffix: str, seps=('_', '-'), n: int = 1, add_date: bool = True) -> Path:
    """
    :param parent: Directory in which a unique file name should be created
    :param stem: File name without extension
    :param suffix: File extension, including `.`
    :param seps: Separators between stem and date/n, respectfully.
    :param n: First number to try; incremented by 1 until adding this value would cause the file name to be unique
    :param add_date: Whether a date should be added before n. If True, a date will always be added.
    :return: Path with a file name that does not currently exist in the target directory
    """
    date_sep, n_sep = seps
    if add_date:
        stem = f'{stem}{date_sep}{datetime.now().strftime("%Y-%m-%d")}'
    name = stem + suffix
    while (path := parent.joinpath(name)).exists():
        name = f'{stem}{n_sep}{n}{suffix}'
        n += 1
    return path