code: def get_grid(
      n: int,  # Number of axes in the returned grid
      nrows: int = None,  # Number of rows in the returned grid, defaulting to `int(math.sqrt(n))`
      ncols: int = None,  # Number of columns in the returned grid, defaulting to `ceil(n/rows)`
      figsize: tuple = None,  # Width, height in inches of the returned figure
      double: bool = False,  # Whether to double the number of columns and `n`
      title: str = None,  # If passed, title set to the figure
      return_fig: bool = False,  # Whether to return the figure created by `subplots`
      flatten: bool = True,  # Whether to flatten the matplot axes such that they can be iterated over with a single loop
      **kwargs,
  ) -> (
      plt.Figure,
      plt.Axes,
  ):  # Returns just `axs` by default, and (`fig`, `axs`) if `return_fig` is set to True
      "Return a grid of `n` axes, `rows` by `cols`"
      if nrows:
          ncols = ncols or int(np.ceil(n / nrows))
      elif ncols:
          nrows = nrows or int(np.ceil(n / ncols))
      else:
          nrows = int(math.sqrt(n))
          ncols = int(np.ceil(n / nrows))
      if double:
          ncols *= 2
          n *= 2
      fig, axs = subplots(nrows, ncols, figsize=figsize, **kwargs)
      if flatten:
          axs = [
              ax if i < n else ax.set_axis_off()
              for i, ax in enumerate(axs.flatten())
          ][:n]
      if title is not None:
          fig.suptitle(title, weight="bold", size=14)
      return (fig, axs) if return_fig else axs
  
imports: from __future__ import annotations
  from ..torch_basics import *
  from ..data.all import *
  from .core import *
  import types
label_desc: Use image node_id 1 for calling a global function with example usage: get_grid(n, nrows, ncols, figsize, double, title, return_fig, flatten) and returns: unknown