code: def pretty_date(time: Union[datetime, int] = False) -> str:
      """
      Get a datetime object or an epoch timestamp and return a
      pretty string like 'an hour ago', 'Yesterday', '3 months ago',
      'just now', etc
      """
      if isinstance(time, int):
          time = datetime.fromtimestamp(time, tz=timezone.utc)
      now = get_current_datetime()
      diff = now - time
      if diff.days < 0:
          return ""
  
      if diff.days == 0:
          if diff.seconds < 10:
              return "now"
          if diff.seconds < 60:
              return str(diff.seconds) + " sec ago"
          if diff.seconds < 120:
              return "1 min ago"
          if diff.seconds < 3600:
              return str(round(diff.seconds / 60)) + " mins ago"
          if diff.seconds < 7200:
              return "1 hour ago"
          if diff.seconds < 86400:
              return str(round(diff.seconds / 3600)) + " hours ago"
      if diff.days == 1:
          return "yesterday"
      if diff.days < 7:
          return str(diff.days) + " days ago"
      if diff.days < 31:
          return str(round(diff.days / 7)) + " weeks ago"
      if diff.days < 365:
          return str(round(diff.days / 30)) + " months ago"
      years = round(diff.days / 365)
      if years == 1:
          return str(years) + " year ago"
      return str(years) + " years ago"
  
file_path: dstack/src/dstack/_internal/utils/common.py
imports: import re
  import time
  from datetime import datetime, timedelta, timezone
  from pathlib import Path
  from typing import Optional, Tuple, Union
label_desc: Use image node_id 4 for calling a global function with example usage: pretty_date(time) and returns: unknown, str, str, unknown, unknown, unknown, unknown, str, unknown, str, unknown, str, unknown