code: def parse_config(fname):
      """Parse a config file (like .ave and .cov files).
  
      Parameters
      ----------
      fname : path-like
          Config file name.
  
      Returns
      -------
      conditions : list of dict
          Each condition is indexed by the event type.
          A condition contains as keys::
  
              tmin, tmax, name, grad_reject, mag_reject,
              eeg_reject, eog_reject
      """
      reject_params = read_reject_parameters(fname)
  
      with open(fname) as f:
          lines = f.readlines()
  
      cat_ind = [i for i, x in enumerate(lines) if "category {" in x]
      event_dict = dict()
      for ind in cat_ind:
          for k in range(ind + 1, ind + 7):
              words = lines[k].split()
              if len(words) >= 2:
                  key = words[0]
                  if key == "event":
                      event = int(words[1])
                      break
          else:
              raise ValueError("Could not find event id.")
          event_dict[event] = dict(**reject_params)
          for k in range(ind + 1, ind + 7):
              words = lines[k].split()
              if len(words) >= 2:
                  key = words[0]
                  if key == "name":
                      name = " ".join(words[1:])
                      if name[0] == '"':
                          name = name[1:]
                      if name[-1] == '"':
                          name = name[:-1]
                      event_dict[event]["name"] = name
                  if key in ["tmin", "tmax", "basemin", "basemax"]:
                      event_dict[event][key] = float(words[1])
      return event_dict
  
label_desc: Use image node_id 1 for calling a global function with example usage: parse_config(fname) and returns: event_dict