def humanized_bytes(size, precision=2):
    """
    Returns a humanized storage size string from bytes
    """
    unit = ""
    for x in ["", "KB", "MB", "GB", "TB"]:
        if size < 1000.0:
            unit = x
            break
        size /= 1000.0
    return f"{size:.{precision}f} {unit}"