code: def _find_optimal(rlist, separator_size=2, displaywidth=80):
      """Calculate optimal info to columnize a list of string"""
      for nrow in range(1, len(rlist) + 1):
          chk = list(map(max, _chunks(rlist, nrow)))
          sumlength = sum(chk)
          ncols = len(chk)
          if sumlength + separator_size * (ncols - 1) <= displaywidth:
              break
      return {
          "columns_numbers": ncols,
          "optimal_separator_width": (displaywidth - sumlength)
          / (ncols - 1)
          if (ncols - 1)
          else 0,
          "rows_numbers": nrow,
          "columns_width": chk,
      }
  
file_path: catboost/contrib/python/ipython-genutils/py2/ipython_genutils/text.py
imports: import os
  import re
  import sys
  import textwrap
  from string import Formatter
label_desc: Use image node_id 6 for calling a global function with example usage: _find_optimal(rlist, separator_size, displaywidth) and returns: dict