code: def make_grid_layout(info, picks=None, n_col=None):
      """Generate .lout file for custom data, i.e., ICA sources.
  
      Parameters
      ----------
      %(info_not_none)s
      %(picks_base)s all good misc channels.
      n_col : int | None
          Number of columns to generate. If None, a square grid will be produced.
  
      Returns
      -------
      layout : Layout
          The generated layout.
  
      See Also
      --------
      make_eeg_layout, generate_2d_layout
      """
      picks = _picks_to_idx(info, picks, "misc")
  
      names = [info["chs"][k]["ch_name"] for k in picks]
  
      if not names:
          raise ValueError("No misc data channels found.")
  
      ids = list(range(len(picks)))
      size = len(picks)
  
      if n_col is None:
          # prepare square-like layout
          n_row = n_col = np.sqrt(size)  # try square
          if n_col % 1:
              # try n * (n-1) rectangle
              n_col, n_row = int(n_col + 1), int(n_row)
  
          if n_col * n_row < size:  # jump to the next full square
              n_row += 1
      else:
          n_row = int(np.ceil(size / float(n_col)))
  
      # setup position grid
      x, y = np.meshgrid(
          np.linspace(-0.5, 0.5, n_col), np.linspace(-0.5, 0.5, n_row)
      )
      x, y = x.ravel()[:size], y.ravel()[:size]
      width, height = _box_size(np.c_[x, y], padding=0.1)
  
      # Some axes will be at the figure edge. Shrink everything so it fits in the
      # figure. Add 0.01 border around everything
      border_x, border_y = (0.01, 0.01)
      x_scaling = 1 / (1.0 + width + border_x)
      y_scaling = 1 / (1.0 + height + border_y)
      x = x * x_scaling
      y = y * y_scaling
      width *= x_scaling
      height *= y_scaling
  
      # Shift to center
      x += 0.5
      y += 0.5
  
      # calculate pos
      pos = np.c_[
          x - 0.5 * width,
          y - 0.5 * height,
          width * np.ones(size),
          height * np.ones(size),
      ]
      box = (0, 1, 0, 1)
  
      layout = Layout(
          box=box, pos=pos, names=names, kind="grid-misc", ids=ids
      )
      return layout
  
imports: import logging
  from collections import defaultdict
  from itertools import combinations
  from pathlib import Path
  import numpy
  from scipy.spatial.distance import pdist, squareform
  from .._fiff.constants import FIFF
  from .._fiff.meas_info import Info
  from .._fiff.pick import _FNIRS_CH_TYPES_SPLIT, _picks_to_idx, pick_types
  from ..transforms import _cart_to_sph, _pol_to_cart
  from ..utils import _check_ch_locs, _check_fname, _check_option, _check_sphere, _clean_names, fill_doc, logger, warn
  from ..viz.topomap import plot_layout
  from .channels import _get_ch_info
label_desc: Use image node_id 5 for calling a global function with example usage: make_grid_layout(info, picks, n_col) and returns: layout