def human_readable_bytes(value, digits=2, delim="", postfix=""):
    """
    Return a human-readable bytes value as a string.

    Args:
        value (int): the bytes value.
        digits (int): how many decimal digits to use.
        delim (str): string to add between value and unit.
        postfix (str): string to add at the end.

    Returns:
        str: the human-readable version of the bytes.
    """
    chosen_unit = "B"
    for unit in ("KiB", "MiB", "GiB", "TiB"):
        if value > 1000:
            value /= 1024
            chosen_unit = unit
        else:
            break
    return f"{value:.{digits}f}" + delim + chosen_unit + postfix