... # simple timestamp
    return time.strftime("%Y-%m-%d %H:%M:%S")


def short(s: str, n: int = 300) -> str:
    s = s or ""
    s = s.replace("\r\n", "\n")
    return s if len(s) <= n else (s[:n] + " ...[cut]")


def safe_filename(s: str) -> str:
    # keep it Windows-safe
    bad = '<>:"/\\|?*'
    out = "".join("_" if c in bad else c for c in s)
    return out[:180] if len(out) > 180 else out


# -...