code: def format_time(seconds):
      
      minute = 60
      hour = minute * 60
      day = hour * 24
      week = day * 7
  
      result = []
      for name, dur in [
              ('week', week), ('day', day), ('hour', hour),
              ('minute', minute), ('second', 1)
      ]:
          if seconds > dur:
              value = seconds // dur
              result.append(
                  '{0} {1}{2}'.format(int(value), name, 's' if value > 1 else '')
              )
              seconds = seconds % dur
      return ' '.join(result)
docs: Format a duration