code: def _write_attribute_categorical(series, fp):
      """Write categories of a categorical/nominal attribute"""
      if isinstance(series.dtype, CategoricalDtype):
          categories = series.cat.categories
          string_values = _check_str_array(categories)
      else:
          categories = series.dropna().unique()
          string_values = sorted(
              _check_str_array(categories), key=lambda x: x.strip('"')
          )
  
      values = ",".join(string_values)
      fp.write("{")
      fp.write(values)
      fp.write("}")
  
file_path: scikit-survival/sksurv/io/arffwrite.py
imports: import os.path
  import re
  import numpy
  import pandas
  from pandas.api.types import CategoricalDtype, is_object_dtype
label_desc: Use image node_id 5 for calling a global function with example usage: _write_attribute_categorical(series, fp) without return types