code: def fmt_size(size, binary=True):
      '''
      Get size and unit.
  
      :param size: size in bytes
      :type size: int
      :param binary: whether use binary or standard units, defaults to True
      :type binary: bool
      :return: size and unit
      :rtype: tuple of int and unit as str
      '''
      if binary:
          fmt_sizes = binary_units
          fmt_divider = 1024.
      else:
          fmt_sizes = standard_units
          fmt_divider = 1000.
      for fmt in fmt_sizes[:-1]:
          if size < 1000:
              return (size, fmt)
          size /= fmt_divider
      return size, fmt_sizes[-1f fmt_size(size, binary=True):
      '''
      Get size and unit.
  
      :param size: size in bytes
      :type size: int
      :param binary: whether use binary or standard units, defaults to True
      :type binary: bool
      :return: size and unit
      :rtype: tuple of int and unit as str
      '''
      if binary:
          fmt_sizes = binary_units
          fmt_divider = 1024.
      else:
          fmt_sizes = standard_units
          fmt_divider = 1000.
      for fmt in fmt_sizes[:-1]:
          if size < 1000:
              return (size, fmt)
          size /= fmt_divider
      return size, fmt_sizes[-1]
docs: Get size and unit.
  
      :param size: size in bytes
      :type size: int
      :param binary: whether use binary or standard units, defaults to True
      :type binary: bool
      :return: size and unit
      :rtype: tuple of int and unit as str