def bytes_to_str(num_bytes: float) -> str:
    """Return a number of bytes as a human-readable string."""
    for unit in ("bytes", "KB", "MB", "GB"):
        if num_bytes < 1024:
            return f"{num_bytes:.1f} {unit}"
        num_bytes /= 1024
    return f"{num_bytes:.1f} TB"