def readable_file_size(file_bytes, precision):
    """
    get size for file or folder

    :param file_bytes: 文件大小，单位：字节数bytes
    :param precision: 小数点后位数，可以是0
    :return:
    """

    for unit in ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB']:
        if abs(file_bytes) < 1024.0:
            return '%s %s' % (format(file_bytes, '.%df' % precision), unit)
        file_bytes /= 1024.0
    return '%s %s' % (format(file_bytes, '.%df' % precision), 'Yi')