code: def format_timedelta(delta) -> str:
      """Formats timedelta to x days, x h, x min, x s."""
      s = delta.total_seconds()
      days, remainder = divmod(s, 86400)
      hours, remainder = divmod(s, 3600)
      mins, secs = divmod(remainder, 60)
  
      days = int(days)
      hours = int(hours)
      mins = int(mins)
      secs = int(secs)
  
      output = f"{secs} s"
      if mins:
          output = f"{mins} min, " + output
      if hours:
          output = f"{hours} h, " + output
      if days:
          output = f"{days} days, " + output
      return output
  
file_path: traintool/traintool/utils.py
imports: from datetime import datetime
label_desc: Use image node_id 3 for calling a global function with example usage: format_timedelta(delta) and returns: output