original_docstring: 
      Formats the timespan in a human readable form
  
      Expects timespan in seconds.
      
docstring: Formats the timespan in a human readable form
  Expects timespan in seconds.
docstring_tokens: Formats the timespan in a human readable form Expects timespan in seconds .
code: def _format_time(timespan):
      """
      Formats the timespan in a human readable form
  
      Expects timespan in seconds.
      """
  
      if timespan >= 60.0:
          # we have more than a minute, format that in a human readable form
          # Idea from http://snipplr.com/view/5713/
          parts = [('d', 60*60*24), ('h', 60*60), ('min', 60), ('s', 1)]
          time = []
          leftover = timespan
          for suffix, length in parts:
              value = int(leftover / length)
              if value > 0:
                  leftover = leftover % length
                  time.append(u'%s%s' % (str(value), suffix))
                  yield value, suffix
                  if leftover < 1:
                      break
          return
  
      # Unfortunately the unicode 'micro' symbol can cause problems in
      # certain terminals.
      # See bug: https://bugs.launchpad.net/ipython/+bug/348466
      # Try to prevent crashes by being more secure than it needs to
      # E.g. eclipse is able to print a µ, but has no sys.stdout.encoding set.
      units = ['s', 'ms', 'us', 'ns']  # the save value
      if hasattr(sys.stdout, 'encoding') and sys.stdout.encoding:
          try:
              '\xb5'.encode(sys.stdout.encoding)
              units = ['s', 'ms', '\xb5s', 'ns']
          except:
              pass
      scaling = [1, 1e3, 1e6, 1e9]
  
      if timespan > 0.0:
          order = min(-int(math.floor(math.log10(timespan)) // 3), 3)
      else:
          order = 3
      value = timespan * scaling[order]
      suffix = units[order]
      yield value, suffix
code_tokens: def _format_time ( timespan ) : if timespan >= 60.0 : parts = [ ( 'd' , 60 * 60 * 24 ) , ( 'h' , 60 * 60 ) , ( 'min' , 60 ) , ( 's' , 1 ) ] time = [ ] leftover = timespan for suffix , length in parts : value = int ( leftover / length ) if value > 0 : leftover = leftover % length time . append ( u'%s%s' % ( str ( value ) , suffix ) ) yield value , suffix if leftover < 1 : break return units = [ 's' , 'ms' , 'us' , 'ns' ] if hasattr ( sys . stdout , 'encoding' ) and sys . stdout . encoding : try : '\xb5' . encode ( sys . stdout . encoding ) units = [ 's' , 'ms' , '\xb5s' , 'ns' ] except : pass scaling = [ 1 , 1e3 , 1e6 , 1e9 ] if timespan > 0.0 : order = min ( - int ( math . floor ( math . log10 ( timespan ) ) // 3 ) , 3 ) else : order = 3 value = timespan * scaling [ order ] suffix = units [ order ] yield value , suffix
short_docstring: Formats the timespan in a human readable form
  Expects timespan in seconds.
short_docstring_tokens: Formats the timespan in a human readable form Expects timespan in seconds .
comment: """
      Formats the timespan in a human readable form
  
      Expects timespan in seconds.
      """$SEP$# we have more than a minute, format that in a human readable form$SEP$# Idea from http://snipplr.com/view/5713/$SEP$# Unfortunately the unicode 'micro' symbol can cause problems in$SEP$# certain terminals.$SEP$# See bug: https://bugs.launchpad.net/ipython/+bug/348466$SEP$# Try to prevent crashes by being more secure than it needs to$SEP$# E.g. eclipse is able to print a µ, but has no sys.stdout.encoding set.$SEP$# the save value