code: def read_fields(line):
      state = RF_STATE_PREQUOTE
      kv = False
      result = []
      field = ""
      for c in line:
          if state == RF_STATE_PREQUOTE:
              if c == '"':
                  state = RF_STATE_FIELD
                  field = ""
              elif c == ":":
                  key = None
                  kv = True
              elif c in ",\n":
                  if kv:
                      result.append((key, None))
                  else:
                      result.append(None)
                  kv = False
          elif state == RF_STATE_BACKSLASH_ESCAPE:
              field += c
              state = RF_STATE_FIELD
          elif state == RF_STATE_SEPARATOR:
              if c == ":":
                  key = field
                  kv = True
                  state = RF_STATE_PREQUOTE
              elif c in ",\n":
                  field = field
                  if kv:
                      result.append((key, field))
                  else:
                      result.append(field)
                  kv = False
                  state = RF_STATE_PREQUOTE
          elif c == "\\":
              field += c
              state = RF_STATE_BACKSLASH_ESCAPE
          elif c == '"':
              state = RF_STATE_SEPARATOR
          else:
              field += c
      return result
  
imports: import bisect
  import re
  import numpy
  from ...constants.pipeline import make_cell_struct_dtype
  from ...constants.pipeline import PIPELINE
  from ...constants.pipeline import IMAGE_PLANE_DESCRIPTOR_VERSION
  from ...constants.pipeline import H_PLANE_COUNT
  from ...constants.pipeline import H_URL
  from ...constants.pipeline import H_SERIES
  from ...constants.pipeline import H_INDEX
  from ...constants.pipeline import H_CHANNEL
  from ...constants.pipeline import RF_STATE_PREQUOTE
  from ...constants.pipeline import RF_STATE_FIELD
  from ...constants.pipeline import RF_STATE_BACKSLASH_ESCAPE
  from ...constants.pipeline import RF_STATE_SEPARATOR
  from ..legacy import cmp
label_desc: Use image node_id 5 for calling a global function with example usage: read_fields(line) and returns: result