code: def read_beamformer(fname):
      """Read a beamformer filter.
  
      Parameters
      ----------
      fname : path-like
          The filename of the HDF5 file.
  
      Returns
      -------
      filter : instance of Beamformer
          The beamformer filter.
      """
      read_hdf5, _ = _import_h5io_funcs()
      beamformer = read_hdf5(fname, title="mnepython")
      if "csd" in beamformer:
          beamformer["csd"] = CrossSpectralDensity(**beamformer["csd"])
      # h5io seems to cast `bool` to `int` on round-trip, probably a bug
      # we should fix at some point (if possible -- could be HDF5 limitation)
      for key in ("normalize_fwd", "is_free_ori", "is_ssp"):
          if key in beamformer:
              beamformer[key] = bool(beamformer[key])
      for key in ("data_cov", "noise_cov"):
          if beamformer.get(key) is not None:
              for pi, p in enumerate(beamformer[key]["projs"]):
                  p = Projection(**p)
                  p["active"] = bool(p["active"])
                  beamformer[key]["projs"][pi] = p
              beamformer[key] = Covariance(
                  *[
                      beamformer[key].get(arg)
                      for arg in (
                          "data",
                          "names",
                          "bads",
                          "projs",
                          "nfree",
                          "eig",
                          "eigvec",
                          "method",
                          "loglik",
                      )
                  ]
              )
      return Beamformer(beamformer)
  
imports: from copy import deepcopy
  import numpy
  from .._fiff.proj import Projection, make_projector
  from ..cov import Covariance, make_ad_hoc_cov
  from ..forward.forward import _restrict_forward_to_src_sel, is_fixed_orient
  from ..minimum_norm.inverse import _get_vertno, _prepare_forward
  from ..source_space._source_space import label_src_vertno_sel
  from ..time_frequency.csd import CrossSpectralDensity
  from ..utils import _check_option, _check_src_normal, _import_h5io_funcs, _pl, _reg_pinv, _sym_mat_pow, check_fname, logger, verbose, warn
label_desc: Use image node_id 8 for calling a global function with example usage: read_beamformer(fname) and returns: Beamformer