import math


def human_readable_size(size, show_sign=False):
    """ Return a human-readable string for a given byte size.
        If show_sign is set, write positive numbers with a leading + sign.
    """
    if size == 0:
        return "0"
    units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
    p = math.floor(math.log(abs(size), 2) / 10)
    maybe_plus = "+" if size > 0 and show_sign else ""
    amt = size / math.pow(1024, p)
    return "%d (%s%.1f %s)" % (size, maybe_plus, amt, units[int(p)])