def pretty_size(total_bytes):
    """Get human-readable file sizes.
    simplified version of https://pypi.python.org/pypi/hurry.filesize/
    """
    factor, suffix = (None, None)
    for factor, suffix in UNITS_MAPPING:
        if total_bytes >= factor:
            break
    if not (factor or suffix):
        return total_bytes
    amount = round(total_bytes / factor, 2)

    # Handling mapping for tuples (in case we want to add more options to the UNITS_MAPPING)
    if isinstance(suffix, tuple):
        singular, multiple = suffix
        if amount == 1:
            suffix = singular
        else:
            suffix = multiple
    return str(amount) + suffix
Get human-readable file sizes.
    simplified version of https://pypi.python.org/pypi/hurry.filesize/
    
src/robusta/integrations/resource_analysis/memory_analyzer.py