r""" makes format string that prints progress: %Xd/MAX_VAL with backspaces

    NOTE: \r can be used instead of backspaces. This function is not very
    relevant because of that.

def progress_str(max_val, lbl='Progress: ', repl=False, approx=False,
                 backspace=PROGGRESS_BACKSPACE):
    r""" makes format string that prints progress: %Xd/MAX_VAL with backspaces

    NOTE: \r can be used instead of backspaces. This function is not very
    relevant because of that.

    """
    # string that displays max value
    max_str = six.text_type(max_val)
    if approx:
        # denote approximate maximum
        max_str = '~' + max_str
    dnumstr = six.text_type(len(max_str))
    # string that displays current progress
    cur_str = '%' + dnumstr + 'd'
    # If user passed in the label
    if repl:
        _fmt_str = lbl.replace('<cur_str>', cur_str).replace('<max_str>', max_str)
    else:
        _fmt_str = lbl + cur_str + '/' + max_str
    if backspace:
        # put backspace characters into the progress string
        # (looks nice on normal terminals)
        #nBackspaces = len(_fmt_str) - len(dnumstr) + len(max_str)
        #backspaces = '\b' * nBackspaces
        #fmt_str = backspaces + _fmt_str
        # FIXME: USE CARAGE RETURN INSTEAD OF BACKSPACES
        fmt_str = '\r' + _fmt_str
    else:
        # FIXME: USE CARAGE RETURN INSTEAD OF BACKSPACES
        # this looks better on terminals without backspaces
        fmt_str = _fmt_str + '\n'
    return fmt_str