def nicesize(nbytes: int, space: str='') ->str:
    """
	Uses IEC 1998 units, such as KiB (1024).
	:param nbytes: Number of bytes
	:param space: Separator between digits and units
	:return: Formatted string
	"""
    data = {'PiB': 1024 ** 5, 'TiB': 1024 ** 4, 'GiB': 1024 ** 3, 'MiB': 
        1024 ** 2, 'KiB': 1024 ** 1}
    for suffix, scale in data.items():
        if nbytes >= scale:
            break
    else:
        scale, suffix = 1, 'B'
    return str(nbytes // scale) + space + suffix
