code: def read_layout(fname=None, *, scale=True):
      """Read layout from a file.
  
      Parameters
      ----------
      fname : path-like | str
          Either the path to a ``.lout`` or ``.lay`` file or the name of a
          built-in layout. c.f. Notes for a list of the available built-in
          layouts.
      scale : bool
          Apply useful scaling for out the box plotting using ``layout.pos``.
          Defaults to True.
  
      Returns
      -------
      layout : instance of Layout
          The layout.
  
      See Also
      --------
      Layout.save
  
      Notes
      -----
      Valid ``fname`` arguments are:
  
      .. table::
         :widths: auto
  
         +----------------------+
         | Kind                 |
         +======================+
         | biosemi              |
         +----------------------+
         | CTF151               |
         +----------------------+
         | CTF275               |
         +----------------------+
         | CTF-275              |
         +----------------------+
         | EEG1005              |
         +----------------------+
         | EGI256               |
         +----------------------+
         | GeodesicHeadWeb-130  |
         +----------------------+
         | GeodesicHeadWeb-280  |
         +----------------------+
         | KIT-125              |
         +----------------------+
         | KIT-157              |
         +----------------------+
         | KIT-160              |
         +----------------------+
         | KIT-AD               |
         +----------------------+
         | KIT-AS-2008          |
         +----------------------+
         | KIT-UMD-3            |
         +----------------------+
         | magnesWH3600         |
         +----------------------+
         | Neuromag_122         |
         +----------------------+
         | Vectorview-all       |
         +----------------------+
         | Vectorview-grad      |
         +----------------------+
         | Vectorview-grad_norm |
         +----------------------+
         | Vectorview-mag       |
         +----------------------+
      """
      readers = {".lout": _read_lout, ".lay": _read_lay}
  
      if isinstance(fname, str):
          # is it a built-in layout?
          directory = Path(__file__).parent / "data" / "layouts"
          for suffix in ("", ".lout", ".lay"):
              _fname = (directory / fname).with_suffix(suffix)
              if _fname.exists():
                  fname = _fname
                  break
      # if not, it must be a valid path provided as str or Path
      fname = _check_fname(
          fname, "read", must_exist=True, name="layout"
      )
      # and it must have a valid extension
      _check_option("fname extension", fname.suffix, readers)
      kind = fname.stem
      box, pos, names, ids = readers[fname.suffix](fname)
  
      if scale:
          pos[:, 0] -= np.min(pos[:, 0])
          pos[:, 1] -= np.min(pos[:, 1])
          scaling = (
              max(np.max(pos[:, 0]), np.max(pos[:, 1])) + pos[0, 2]
          )
          pos /= scaling
          pos[:, :2] += 0.03
          pos[:, :2] *= 0.97 / 1.03
          pos[:, 2:] *= 0.94
  
      return Layout(box=box, pos=pos, names=names, kind=kind, ids=ids)
  
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 3 for calling a global function with example usage: read_layout(fname) and returns: Layout