from pathlib import Path
from datetime import datetime


def add_timestamp_to_fn(fn: Path) -> Path:
    """
    Append a timestamp to a filename.
    """
    dtfmt = "%Y%m%d-%H%M%S"

    original_name = fn.stem
    new_name = original_name + "_" + datetime.today().strftime(dtfmt)
    fn = fn.parent / (new_name + fn.suffix)

    return fn