code: def find_pretty_grid(n_plots, max_cols=5):
      """Determine a good grid shape for subplots.
  
      Tries to find a way to arange n_plots many subplots on a grid in a way
      that fills as many grid-cells as possible, while keeping the number
      of rows low and the number of columns below max_cols.
  
      Parameters
      ----------
      n_plots : int
          Number of plots to arrange.
      max_cols : int, default=5
          Maximum number of columns.
  
      Returns
      -------
      n_rows : int
          Number of rows in grid.
      n_cols : int
          Number of columns in grid.
  
      Examples
      --------
      >>> find_pretty_grid(16, 5)
      (4, 4)
      >>> find_pretty_grid(11, 5)
      (3, 4)
      >>> find_pretty_grid(10, 5)
      (2, 5)
      """
  
      # we could probably do something with prime numbers here
      # but looks like that becomes a combinatorial problem again?
      if n_plots % max_cols == 0:
          # perfect fit!
          # if max_cols is 6 do we prefer 6x1 over 3x2?
          return int(n_plots / max_cols), max_cols
      # min number of rows needed
      min_rows = int(np.ceil(n_plots / max_cols))
      best_empty = max_cols
      best_cols = max_cols
      for cols in range(max_cols, min_rows - 1, -1):
          # we only allow getting narrower if we have more cols than rows
          remainder = n_plots % cols
          empty = cols - remainder if remainder != 0 else 0
          if empty == 0:
              return int(n_plots / cols), cols
          if empty < best_empty:
              best_empty = empty
              best_cols = cols
      return int(np.ceil(n_plots / best_cols)), best_cols
  
imports: from warnings import warn
  from functools import reduce
  import itertools
  import numpy
  import pandas
  import matplotlib.pyplot
  from matplotlib.axes import Axes
  from matplotlib.patches import Rectangle, Patch
  from matplotlib.ticker import EngFormatter
  from seaborn.utils import despine
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.metrics import roc_curve
  from sklearn.model_selection import cross_val_score, StratifiedShuffleSplit
  from ..preprocessing import detect_types
  from .._config import get_config
label_desc: Use image node_id 1 for calling a global function with example usage: find_pretty_grid(n_plots, max_cols) and returns: int,  best_cols, int,  max_cols, int,  cols