code: def _draw_progressbar(self, columns=None, len_prefix=0, right_margin=0):
      
      if self._order == None:
        total = len(self._results)
      else:
        total = max(len(self._order), len(self._results))
  
      percent = int(round(len(self._results)/total*100)) if total else 0
  
      needs_break = lambda count: columns and count > columns \
                                  and (count % (columns - right_margin))
  
      # together with unicode_literals `str('status')` seems the best
      # py2 and py3 compatible solution
      status = type(str('status'), (object,), dict(count=0,progressbar=[]))
      def _append(status, item, length=1, separator=''):
        # * assuming a standard item will take one column in the tty
        # * length must not be bigger than columns (=very narrow columns)
        progressbar = status.progressbar
        if needs_break(status.count + length + len(separator)):
          progressbar.append('\n')
          status.count = 0
        else:
          progressbar.append(separator)
        status.count += length + len(separator)
        progressbar.append(item)
      append=partial(_append, status)
      progressbar = status.progressbar
  
      append('', len_prefix)
      append('[')
      for item in self._progressbar:
        append(item)
      append(']')
      percentstring = f'{percent:3d}%'
      append(percentstring, len(percentstring), ' ')
      return ''.join(progressbar)
docs: if columns is None, don't insert any extra line breaks