code: def write_channel_list_file(channels, fobj):
      
      if not isinstance(fobj, FILE_LIKE):
          with open(fobj, "w") as fobj:
              return write_channel_list_file(channels, fobj)
  
      out = configparser.ConfigParser(dict_type=OrderedDict)
      for channel in channels:
          group = channel.group
          if not out.has_section(group):
              out.add_section(group)
          for param, value in channel.params.items():
              out.set(group, param, value)
          if channel.sample_rate is not None:
              entry = '%s %s' % (str(channel),
                                 str(channel.sample_rate.to('Hz').value))
          else:
              entry = str(channel)
          entry += ' %s' % channel.params.get('safe', 'safe')
          entry += ' %s' % channel.params.get('fidelity', 'clean')
          try:
              clist = out.get(group, 'channels')
          except configparser.NoOptionError:
              out.set(group, 'channels', '\n%s' % entry)
          else:
              out.set(group, 'channels', clist + '\n%s' % entry)
  
      out.write(fobj)
docs: Write a `~gwpy.detector.ChannelList` to a INI-format channel list file