code: def _to_format_helper(view, options=None):
      """Retrieves the data slice and column names in preparation for data
      serialization.
      """
      options = options or {}
      opts = _parse_format_options(view, options)
  
      if view._is_unit_context:
          data_slice = get_data_slice_unit(
              view._view,
              opts["start_row"],
              opts["end_row"],
              opts["start_col"],
              opts["end_col"],
          )
      elif view._sides == 0:
          data_slice = get_data_slice_zero(
              view._view,
              opts["start_row"],
              opts["end_row"],
              opts["start_col"],
              opts["end_col"],
          )
      elif view._sides == 1:
          data_slice = get_data_slice_one(
              view._view,
              opts["start_row"],
              opts["end_row"],
              opts["start_col"],
              opts["end_col"],
          )
      else:
          data_slice = get_data_slice_two(
              view._view,
              opts["start_row"],
              opts["end_row"],
              opts["start_col"],
              opts["end_col"],
          )
  
      raw_names = data_slice.get_column_names()
      column_names = []
  
      for n in raw_names:
          column_names.append(
              COLUMN_SEPARATOR_STRING.join(
                  [path.to_string(False) for path in n]
              )
          )
  
      return opts, column_names, data_slice
  
imports: import numpy
  from math import floor, ceil, trunc
  from ._constants import COLUMN_SEPARATOR_STRING
  from .libpsppy import get_data_slice_unit, get_data_slice_zero, get_data_slice_one, get_data_slice_two, get_from_data_slice_unit, get_from_data_slice_zero, get_from_data_slice_one, get_from_data_slice_two, get_pkeys_from_data_slice_unit, get_pkeys_from_data_slice_zero, get_pkeys_from_data_slice_one, get_pkeys_from_data_slice_two, scalar_to_py
label_desc: Use image node_id 3 for calling a global function with example usage: _to_format_helper(view, options) and returns: opts,  column_names,  data_slice