def humanize_units(byte_count, divisor=1024.0):
    """
    Convert a raw byte count into human-readable base2 units
    """
    units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB']
    result = byte_count
    index = 0
    while index < len(units) - 1:
        new_result = result / divisor
        if new_result < 1.0:
            break
        else:
            index += 1
            result = new_result
    return result, units[index]
