def byte_number_string(number, thousandsSep=True, partition=False, base1024
    =True, appendBytes=True):
    """Convert bytes into human-readable representation."""
    magsuffix = ''
    bytesuffix = ''
    if partition:
        magnitude = 0
        if base1024:
            while number >= 1024:
                magnitude += 1
                number = number >> 10
        else:
            while number >= 1000:
                magnitude += 1
                number /= 1000.0
        magsuffix = ['', 'K', 'M', 'G', 'T', 'P'][magnitude]
    if appendBytes:
        if number == 1:
            bytesuffix = ' Byte'
        else:
            bytesuffix = ' Bytes'
    if thousandsSep and (number >= 1000 or magsuffix):
        snum = '{:,d}'.format(number)
    else:
        snum = str(number)
    return '{}{}{}'.format(snum, magsuffix, bytesuffix)
