def progress_bar(val, val_max, val_min=0, prefix="", suffix="", bar_len=20):
    """
    Displays a progress bar in the simulation tree.
    :param val: current value
    :param val_max: maximum value
    :param val_min: minimum value
    :param prefix: marker for the completed part
    :param suffix: marker for the incomplete part
    :param bar_len: total length of the progress bar
    :return: a string representation of the progressbar
    """
    if val_max == 0:
        return ""
    else:
        skipped_len = int(round(bar_len * val_min) / float(val_max))
        filled_len = int(round(bar_len * (val - val_min) / float(val_max)))
        # percents = round(100.0 * count / float(total), 1)
        bar = (
            "." * skipped_len
            + "|" * filled_len
            + "." * (bar_len - filled_len - skipped_len)
        )
        # return '[%s] %s%s %s\r' % (bar, percents, '%', suffix)
        return "%s [%s] %s\r" % (prefix, bar, suffix)