code: def throughput(sample, window=1, format='decimal'):
      '''
      Return the throughput in (intelli)bytes per second.
  
      :param sample: number of samples sent
      :param window: default 1, sample window in seconds or
                     :class:`datetime.timedelta` object
      :param format: default 'decimal', see :func:`natural.size.filesize`
  
      >>> print(throughput(123456, 42))
      2.87 kB/s
      '''
  
      if isinstance(window, datetime.timedelta):
          window = float(window.days * 86400 + window.seconds)
      elif isinstance(window, six.string_types):
          window = float(window)
  
      per_second = sample / float(window)
      return _('%s/s') % (filesize(per_second, format=format),f throughput(sample, window=1, format='decimal'):
      '''
      Return the throughput in (intelli)bytes per second.
  
      :param sample: number of samples sent
      :param window: default 1, sample window in seconds or
                     :class:`datetime.timedelta` object
      :param format: default 'decimal', see :func:`natural.size.filesize`
  
      >>> print(throughput(123456, 42))
      2.87 kB/s
      '''
  
      if isinstance(window, datetime.timedelta):
          window = float(window.days * 86400 + window.seconds)
      elif isinstance(window, six.string_types):
          window = float(window)
  
      per_second = sample / float(window)
      return _('%s/s') % (filesize(per_second, format=format),)
docs: Return the throughput in (intelli)bytes per second.
  
      :param sample: number of samples sent
      :param window: default 1, sample window in seconds or
                     :class:`datetime.timedelta` object
      :param format: default 'decimal', see :func:`natural.size.filesize`
  
      >>> print(throughput(123456, 42))
      2.87 kB/s