code: def _set_sfreq(ft_struct):
      """Set the sample frequency."""
      try:
          sfreq = ft_struct["fsample"]
      except KeyError:
          try:
              time = ft_struct["time"]
          except KeyError:
              raise ValueError("No Source for sfreq found")
          else:
              t1, t2 = float(time[0]), float(time[1])
              sfreq = 1 / (t2 - t1)
      try:
          sfreq = float(sfreq)
      except TypeError:
          warn(
              "FieldTrip structure contained multiple sample rates, trying the "
              f"first of:\n{sfreq} Hz"
          )
          sfreq = float(sfreq.ravel()[0])
      return sfreq
  
file_path: mne-python/mne/io/fieldtrip/utils.py
imports: import numpy
  from ..._fiff._digitization import DigPoint, _ensure_fiducials_head
  from ..._fiff.constants import FIFF
  from ..._fiff.meas_info import create_info
  from ..._fiff.pick import pick_info
  from ...transforms import rotation3d_align_z_axis
  from ...utils import _check_pandas_installed, warn
label_desc: Use image node_id 5 for calling a global function with example usage: _set_sfreq(ft_struct) and returns: sfreq