from pathlib import Path


def append_to_filename(path: Path, addition: str) -> Path:
    """
    >>> p = Path('file.txt')
    >>> append_to_filename(p, '-appended')
    PosixPath('file-appended.txt')
    """
    new_filename = f'{path.stem}{addition}{path.suffix}'
    return path.parent / new_filename