code: def axes_grid(n, sharex=False, sharey=False, subplot_kw=None, **fig_kw):
    '''Finds a reasonable arrangement of n axes. Returns (fig, axes) tuple.
    For keyword arguments descriptions, see matplotlib.pyplot.subplots'''
    r = np.floor(np.sqrt(n))
    r, c = int(r), int(np.ceil(n / r))
    fig, axes = plt.subplots(nrows=r, ncols=c, figsize=(c*4, r*4), squeeze=False,
                             sharex=sharex, sharey=sharey,
                             subplot_kw=subplot_kw, **fig_kw)
    # Turn off any extra axes
    for ax in axes.flat[n:]:
      ax.set_axis_off()
    return fig, axef axes_grid(n, sharex=False, sharey=False, subplot_kw=None, **fig_kw):
    '''Finds a reasonable arrangement of n axes. Returns (fig, axes) tuple.
    For keyword arguments descriptions, see matplotlib.pyplot.subplots'''
    r = np.floor(np.sqrt(n))
    r, c = int(r), int(np.ceil(n / r))
    fig, axes = plt.subplots(nrows=r, ncols=c, figsize=(c*4, r*4), squeeze=False,
                             sharex=sharex, sharey=sharey,
                             subplot_kw=subplot_kw, **fig_kw)
    # Turn off any extra axes
    for ax in axes.flat[n:]:
      ax.set_axis_off()
    return fig, axes
docs: Finds a reasonable arrangement of n axes. Returns (fig, axes) tuple.
    For keyword arguments descriptions, see matplotlib.pyplot.subplots