(num_bytes)
Return the given bytes as a human friendly KB, MB, GB, or TB string
    thanks https://stackoverflow.com/questions/12523586/python-format-size-application-converting-b-to-kb-mb-gb-tb
Return the given bytes as a human friendly KB, MB, GB, or TB string
    thanks https://stackoverflow.com/questions/12523586/python-format-size-application-converting-b-to-kb-mb-gb-tb
Return the given bytes as a human friendly KB MB GB or TB string thanks https : // stackoverflow . com / questions / 12523586 / python - format - size - application - converting - b - to - kb - mb - gb - tb
def _get_human_bytes(num_bytes):
    """Return the given bytes as a human friendly KB, MB, GB, or TB string
    thanks https://stackoverflow.com/questions/12523586/python-format-size-application-converting-b-to-kb-mb-gb-tb
    """
    num_bytes = float(num_bytes)
    one_kb = float(1024)
    one_mb = float(one_kb ** 2)  # 1,048,576
    one_gb = float(one_kb ** 3)  # 1,073,741,824
    one_tb = float(one_kb ** 4)  # 1,099,511,627,776

    if num_bytes < one_kb:
        return '{0} {1}'.format(bytes, 'Bytes' if 0 == num_bytes > 1 else 'Byte')
    elif one_kb <= num_bytes < one_mb:
        return '{0:.2f} KB'.format(num_bytes / one_kb)
    elif one_mb <= num_bytes < one_gb:
        return '{0:.2f} MB'.format(num_bytes / one_mb)
    elif one_gb <= num_bytes < one_tb:
        return '{0:.2f} GB'.format(num_bytes / one_gb)
    else:
        return '{0:.2f} TB'.format(num_bytes / one_tb)
def _get_human_bytes ( num_bytes ) : num_bytes = float ( num_bytes ) one_kb = float ( 1024 ) one_mb = float ( one_kb ** 2 ) # 1,048,576 one_gb = float ( one_kb ** 3 ) # 1,073,741,824 one_tb = float ( one_kb ** 4 ) # 1,099,511,627,776 if num_bytes < one_kb : return '{0} {1}' . format ( bytes , 'Bytes' if 0 == num_bytes > 1 else 'Byte' ) elif one_kb <= num_bytes < one_mb : return '{0:.2f} KB' . format ( num_bytes / one_kb ) elif one_mb <= num_bytes < one_gb : return '{0:.2f} MB' . format ( num_bytes / one_mb ) elif one_gb <= num_bytes < one_tb : return '{0:.2f} GB' . format ( num_bytes / one_gb ) else : return '{0:.2f} TB' . format ( num_bytes / one_tb )