code: def deltafmt(delta, decimals = None):
      
      try:
          delta = float(delta)
      except:
          return '(bad delta: %s)' % (str(delta),)
      if delta < 60:
          if decimals is None:
              decimals = 2
          return ("{0:."+str(decimals)+"f}s").format(delta)
      mins = int(delta/60)
      secs = delta - mins*60
      if delta < 600:
          if decimals is None:
              decimals = 1
          return ("{0:d}m{1:."+str(decimals)+"f}s").format(mins, secs)
      if decimals is None:
          decimals = 0
      hours = int(mins/60)
      mins -= hours*60
      if delta < 3600:
          return "{0:d}m{1:.0f}s".format(mins, secs)
      else:
          return ("{0:d}h{1:d}m{2:."+str(decimals)+"f}s").format(hours, mins, secs)
docs: Returns a human readable representation of a time with the format:
  
      [[[Ih]Jm]K[.L]s
  
  For example: 6h5m23s
  
  If "decimals" is specified, the seconds will be output with that many decimal places.
  If not, there will be two places for times less than 1 minute, one place for times
  less than 10 minutes, and zero places otherwise