code: def _build_segment_content(
      begin_time,
      end_time,
      event_time,
      eeg_bads,
      status="unedited",
      name=None,
      pns_bads=None,
      nsegs=None,
  ):
      """Build content for a single segment in categories.xml.
  
      Segments are sorted into categories in categories.xml. In a segmented MFF
      each category can contain multiple segments, but in an averaged MFF each
      category only contains one segment (the average).
      """
      channel_status = [
          {
              "signalBin": 1,
              "exclusion": "badChannels",
              "channels": eeg_bads,
          }
      ]
      if pns_bads:
          channel_status.append(
              {
                  "signalBin": 2,
                  "exclusion": "badChannels",
                  "channels": pns_bads,
              }
          )
      content = {
          "status": status,
          "beginTime": begin_time,
          "endTime": end_time,
          "evtBegin": event_time,
          "evtEnd": event_time,
          "channelStatus": channel_status,
      }
      if name:
          content["name"] = name
      if nsegs:
          content["keys"] = {"#seg": {"type": "long", "data": nsegs}}
      return content
  
file_path: mne-python/mne/export/_egimff.py
imports: import datetime
  import os
  import os.path
  import shutil
  import numpy
  from .._fiff.pick import pick_channels, pick_types
  from ..io.egi.egimff import _import_mffpy
  from ..utils import _check_fname, verbose, warn
label_desc: Use image node_id 4 for calling a global function with example usage: _build_segment_content(begin_time, end_time, event_time, eeg_bads, status, name, pns_bads, nsegs) and returns: content