code: def serialize_array(array, filepath):
      """Save an array on disk on a format that tick C++ modules can read
  
      This method is intended to be used by developpers only, mostly for
      benchmarking in C++ on real datasets imported from Python
  
      Parameters
      ----------
      array : `np.ndarray` or `scipy.sparse.csr_matrix`
          1d or 2d array
  
      filepath : `str`
          Path where the array will be stored
  
      Returns
      -------
      path : `str`
          Global path of the serialized array
      """
      if array.dtype not in [np.float32, np.float64]:
          raise ValueError("Only float32/64 arrays can be serrialized")
  
      if array.dtype == "float32":
          if isinstance(array, np.ndarray):
              if len(array.shape) == 1:
                  serializer = tick_float_array_to_file
              elif len(array.shape) == 2:
                  if array.flags["F_CONTIGUOUS"]:
                      serializer = tick_float_colmaj_array2d_to_file
                  else:
                      serializer = tick_float_array2d_to_file
              else:
                  raise ValueError(
                      "Only 1d and 2d arrays can be serrialized"
                  )
          else:
              if len(array.shape) == 2:
                  if isinstance(array, scipy.sparse.csc.csc_matrix):
                      serializer = tick_float_colmaj_sparse2d_to_file
                  else:
                      serializer = tick_float_sparse2d_to_file
              else:
                  raise ValueError(
                      "Only 2d sparse arrays can be serrialized"
                  )
      elif array.dtype == "float64" or array.dtype == "double":
          if isinstance(array, np.ndarray):
              if len(array.shape) == 1:
                  serializer = tick_double_array_to_file
              elif len(array.shape) == 2:
                  if array.flags["F_CONTIGUOUS"]:
                      serializer = tick_double_colmaj_array2d_to_file
                  else:
                      serializer = tick_double_array2d_to_file
              else:
                  raise ValueError(
                      "Only 1d and 2d arrays can be serrialized"
                  )
          else:
              if len(array.shape) == 2:
                  if isinstance(array, scipy.sparse.csc.csc_matrix):
                      serializer = tick_double_colmaj_sparse2d_to_file
                  else:
                      serializer = tick_double_sparse2d_to_file
              else:
                  raise ValueError(
                      "Only 2d sparse arrays can be serrialized"
                  )
      else:
          raise ValueError("Unhandled serrialization type")
  
      serializer(filepath, array)
      return os.path.abspath(filepath)
  
imports: import os
  import numpy
  import scipy
  from tick.array.build.array import tick_float_array_to_file, tick_float_array2d_to_file, tick_float_sparse2d_to_file, tick_double_array_to_file, tick_double_array2d_to_file, tick_double_sparse2d_to_file, tick_float_array_from_file, tick_float_array2d_from_file, tick_float_sparse2d_from_file, tick_double_array_from_file, tick_double_array2d_from_file, tick_double_sparse2d_from_file, tick_float_colmaj_sparse2d_to_file, tick_float_colmaj_sparse2d_from_file, tick_double_colmaj_sparse2d_to_file, tick_double_colmaj_sparse2d_from_file, tick_double_colmaj_array2d_to_file, tick_double_colmaj_array2d_from_file, tick_float_colmaj_array2d_to_file, tick_float_colmaj_array2d_from_file
label_desc: Use image node_id 1 for calling a global function with example usage: serialize_array(array, filepath) and returns: os