docs: def filesizeformat(bytes, decimals=1):
      """
      Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB,
      102 bytes, etc).
      Based on django.template.defaultfilters.filesizeformat
      """
  
      try:
          bytes = float(bytes)
      except (TypeError, ValueError, UnicodeDecodeError):
          raise ValueError
  
      def filesize_number_format(value):
          return formats.number_format(round(value, decimals), decimals)
  
      units_list = sorted(six.iteritems(FILESIZE_UNITS), key=operator.itemgetter(1))
  
      value = unit = None
      len_unints_list = len(units_list)
      for i in xrange(1, len_unints_list):
          if bytes < units_list[i][1]:
              prev_unit = units_list[i - 1]
              value = filesize_number_format(bytes / prev_unit[1])
              unit = prev_unit[0]
              break
  
      if value is None:
          value = filesize_number_format(bytes / units_list[-1][1])
          unit = units_list[-1][0]
  
      return SIZEFIELD_FORMAT.format(value=value, unit=unit)