def _make_progress(self, row, width):
        # formatted percent has a max length of 4 (100%)
        # _format_filesize can return at most a string of length 10 (1,024.0 KB)
        # _format_time can return at most a string of length 8 (23 hours)
        NO_PROGRESS_FORMAT_STR = "{:<4} {:>10}/{:<10}"
        PROGRESS_FORMAT_STR = "{:<4} {} {:>10}/{:<10}"
        RATE_FORMAT_STR = "{:>10}/s"
        TIME_LEFT_FORMAT_STR = "{:>13}"

        try:
            current = row.bytes_downloaded or 0
            total = row.bytes_total or 0
            rate = row.download_rate or 0
            time_left = row.data.get('time_left', -1)

            percent = 0 if total == 0 else current * 1.0 / total
            formatted = [
                "%d%%" % int(percent * 100),
                self._format_filesize(current),
                self._format_filesize(total)
            ]
            formatted_rate = self._format_filesize(rate)
            formatted_time_left = self._format_time(time_left)
        except __HOLE__:
            percent = 0
            formatted = [ '0%', '--', '--' ]
            formatted_rate = '--'
            formatted_time_left = '--'

        string_without_progress = NO_PROGRESS_FORMAT_STR.format(*formatted)

        progress_width = width - len(string_without_progress)
        # Bar is surrounded by brackets [] and an extra space
        bar_width = progress_width - 3

        if bar_width <= 0:
            return string_without_progress

        filled_bar_width = int(bar_width * percent)
        bar = '=' * filled_bar_width
        if not filled_bar_width == bar_width and not percent == 0:
            bar += '>'

        formatted_bar = "[{0:{1}}]".format(bar, bar_width)
        formatted.insert(1, formatted_bar)

        return {
            'progress': PROGRESS_FORMAT_STR.format(*formatted),
            'rate': RATE_FORMAT_STR.format(formatted_rate),
            'time_left': TIME_LEFT_FORMAT_STR.format(formatted_time_left)
        }
dataset/ETHPy150Open memsql/memsql-loader/memsql_loader/cli/ps.py/Processes._make_progress