@register.filter
def download_speed(kbytes_per_second):
  """Returns HTML markup for KB/s."""
  if not kbytes_per_second:  # includes None and 0 intentionally.
    return 'N/A'

  if kbytes_per_second < 1024:
    return '%s KB/s' % kbytes_per_second
  else:
    return '%.2f MB/s' % (float(kbytes_per_second) / 1024)
dataset/ETHPy150Open google/simian/src/simian/mac/admin/custom_filters.py/download_speed/original