def humanFrequency(hertz):
 divisor = 1000
 if (hertz < divisor):
  return (u'%u Hz' % hertz)
 units = [u'kHz', u'MHz', u'GHz', u'THz']
 hertz = float(hertz)
 for unit in units:
  hertz = (hertz / divisor)
  if (hertz < divisor):
   return (u'%.1f %s' % (hertz, unit))
 return (u'%s %s' % (hertz, unit))

def humanFrequency ( hertz ) : divisor = 1000 if ( hertz < divisor ) : return ( u'%u Hz' % hertz ) units = [ u'kHz' , u'MHz' , u'GHz' , u'THz' ] hertz = float ( hertz ) for unit in units : hertz = ( hertz / divisor ) if ( hertz < divisor ) : return ( u'%.1f %s' % ( hertz , unit ) ) return ( u'%s %s' % ( hertz , unit ) )
convert a frequency in hertz to human classic representation .