code: def format_time( sec ):
      ''' Re-formats time duration in seconds (*sec*) into more easily readable 
          form, where (days,) hours, minutes, and seconds are explicitly shown.
          Returns the new duration as a formatted string.
      '''
      import time
      if sec < 864000:
         # Idea from:   http://stackoverflow.com/a/1384565
         return time.strftime('%H:%M:%S', time.gmtime(sec))
      else:
         days = int(sec / 864000)
         secs = sec % 864000
         return str(days)+'d, '+time.strftime('%H:%M:%S', time.gmtime(secs)f format_time( sec ):
      ''' Re-formats time duration in seconds (*sec*) into more easily readable 
          form, where (days,) hours, minutes, and seconds are explicitly shown.
          Returns the new duration as a formatted string.
      '''
      import time
      if sec < 864000:
         # Idea from:   http://stackoverflow.com/a/1384565
         return time.strftime('%H:%M:%S', time.gmtime(sec))
      else:
         days = int(sec / 864000)
         secs = sec % 864000
         return str(days)+'d, '+time.strftime('%H:%M:%S', time.gmtime(secs))
docs: Re-formats time duration in seconds (*sec*) into more easily readable 
          form, where (days,) hours, minutes, and seconds are explicitly shown.
          Returns the new duration as a formatted string.