def format_size(size):
    """Format a size of a file in bytes to be human-readable."""
    size = int(size)
    if size > 1024:
        kib = size // 1024 + (size % 1024) / 1024.0
        return ('%.2f' % kib).rstrip('0').rstrip('.') + ' KiB'
    return '%d B' % size