code: def _read_forward_meas_info(tree, fid):
      """Read light measurement info from forward operator.
  
      Parameters
      ----------
      tree : tree
          FIF tree structure.
      fid : file id
          The file id.
  
      Returns
      -------
      %(info_not_none)s
      """
      # This function assumes fid is being used as a context manager
      info = Info()
      info._unlocked = True
  
      # Information from the MRI file
      parent_mri = dir_tree_find(tree, FIFF.FIFFB_MNE_PARENT_MRI_FILE)
      if len(parent_mri) == 0:
          raise ValueError(
              "No parent MEG information found in operator"
          )
      parent_mri = parent_mri[0]
  
      tag = find_tag(fid, parent_mri, FIFF.FIFF_MNE_FILE_NAME)
      info["mri_file"] = tag.data if tag is not None else None
      tag = find_tag(fid, parent_mri, FIFF.FIFF_PARENT_FILE_ID)
      info["mri_id"] = tag.data if tag is not None else None
  
      # Information from the MEG file
      parent_meg = dir_tree_find(tree, FIFF.FIFFB_MNE_PARENT_MEAS_FILE)
      if len(parent_meg) == 0:
          raise ValueError(
              "No parent MEG information found in operator"
          )
      parent_meg = parent_meg[0]
  
      tag = find_tag(fid, parent_meg, FIFF.FIFF_MNE_FILE_NAME)
      info["meas_file"] = tag.data if tag is not None else None
      tag = find_tag(fid, parent_meg, FIFF.FIFF_PARENT_FILE_ID)
      info["meas_id"] = tag.data if tag is not None else None
  
      # Add channel information
      info["chs"] = chs = list()
      for k in range(parent_meg["nent"]):
          kind = parent_meg["directory"][k].kind
          pos = parent_meg["directory"][k].pos
          if kind == FIFF.FIFF_CH_INFO:
              tag = read_tag(fid, pos)
              chs.append(tag.data)
      ch_names_mapping = _read_extended_ch_info(chs, parent_meg, fid)
      info._update_redundant()
  
      # Get the MRI <-> head coordinate transformation
      tag = find_tag(fid, parent_mri, FIFF.FIFF_COORD_TRANS)
      coord_head = FIFF.FIFFV_COORD_HEAD
      coord_mri = FIFF.FIFFV_COORD_MRI
      coord_device = FIFF.FIFFV_COORD_DEVICE
      coord_ctf_head = FIFF.FIFFV_MNE_COORD_CTF_HEAD
      if tag is None:
          raise ValueError(
              "MRI/head coordinate transformation not found"
          )
      cand = tag.data
      if cand["from"] == coord_mri and cand["to"] == coord_head:
          info["mri_head_t"] = cand
      else:
          raise ValueError(
              "MRI/head coordinate transformation not found"
          )
  
      # Get the MEG device <-> head coordinate transformation
      tag = find_tag(fid, parent_meg, FIFF.FIFF_COORD_TRANS)
      if tag is None:
          raise ValueError(
              "MEG/head coordinate transformation not found"
          )
      cand = tag.data
      if cand["from"] == coord_device and cand["to"] == coord_head:
          info["dev_head_t"] = cand
      elif cand["from"] == coord_ctf_head and cand["to"] == coord_head:
          info["ctf_head_t"] = cand
      else:
          raise ValueError(
              "MEG/head coordinate transformation not found"
          )
  
      bads = _read_bad_channels(
          fid, parent_meg, ch_names_mapping=ch_names_mapping
      )
      # clean up our bad list, old versions could have non-existent bads
      info["bads"] = [bad for bad in bads if bad in info["ch_names"]]
  
      # Check if a custom reference has been applied
      tag = find_tag(fid, parent_mri, FIFF.FIFF_MNE_CUSTOM_REF)
      if tag is None:
          tag = find_tag(
              fid, parent_mri, 236
          )  # Constant 236 used before v0.11
  
      info["custom_ref_applied"] = (
          int(tag.data.item()) if tag is not None else False
      )
      info._unlocked = False
      return info
  
imports: import os
  import re
  import shutil
  import tempfile
  from copy import deepcopy
  from os import PathLike
  from os import path
  from pathlib import Path
  from time import time
  import numpy
  from scipy import sparse
  from .._fiff.constants import FIFF
  from .._fiff.matrix import _read_named_matrix, _transpose_named_matrix, write_named_matrix
  from .._fiff.meas_info import Info, _make_ch_names_mapping, _read_bad_channels, _read_extended_ch_info, _write_bad_channels, _write_ch_infos, write_info
  from .._fiff.open import fiff_open
  from .._fiff.pick import pick_channels, pick_channels_forward, pick_info, pick_types
  from .._fiff.tag import find_tag, read_tag
  from .._fiff.tree import dir_tree_find
  from .._fiff.write import end_block, start_and_end_file, start_block, write_coord_trans, write_id, write_int, write_string
  from ..epochs import BaseEpochs
  from ..evoked import Evoked, EvokedArray
  from ..html_templates import _get_html_template
  from ..io import BaseRaw, RawArray
  from ..label import Label
  from ..source_estimate import _BaseSourceEstimate, _BaseVectorSourceEstimate
  from ..source_space._source_space import _get_src_nn, _read_source_spaces_from_tree, _set_source_space_vertices, _src_kind_dict, _write_source_spaces_to_fid, find_source_space_hemi
  from ..surface import _normal_orth
  from ..transforms import invert_transform, transform_surface_to, write_trans
  from ..utils import _check_compensation_grade, _check_fname, _check_option, _check_stc_units, _import_h5io_funcs, _on_missing, _stamp_to_dt, _validate_type, check_fname, fill_doc, get_subjects_dir, has_mne_c, logger, repr_html, run_subprocess, verbose, warn
label_desc: Use image node_id 4 for calling a global function with example usage: _read_forward_meas_info(tree, fid) and returns: info