In vyos.util we have seconds_to_human, bytes_to_human and human_to_bytes functions that make it simpler to transform time and size data for display.
Exposing them as Jinja2 filters can make them a lot simpler to use from templates, not only from scripts.