def human_size(nbytes):
    """
    This function takes a number of bytes as input and converts it to a human-readable
    size representation with appropriate units (e.g., KB, MB, GB, TB).
    """
    suffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]

    # Find the appropriate unit suffix and convert bytes to higher units
    for i in range(len(suffixes)):
        if nbytes < 1024 or i == len(suffixes) - 1:
            break
        nbytes /= 1024.0

    # Format the number of bytes with two decimal places and remove trailing zeros and decimal point
    size_str = f"{nbytes:.2f}".rstrip("0").rstrip(".")

    # Return the human-readable size with the appropriate unit suffix
    return f"{size_str} {suffixes[i]}"

    This function takes a number of bytes as input and converts it to a human-readable
    size representation with appropriate units (e.g., KB, MB, GB, TB).
    
cme/modules/spider_plus.py