code: def _write_cmap_to_file(cmap_filename, cmap_data):
      ext = os.path.splitext(cmap_filename)[1]
      if ext in (".npy",):
          np.save(cmap_filename, cmap_data)
      elif ext in (".npz",):
          np.savez(cmap_filename, cmap_data)
      else:
          np.savetxt(cmap_filename, cmap_data, delimiter=",")
  
imports: import contextlib
  import os
  from tempfile import NamedTemporaryFile
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  import xarray
  from satpy.enhancements import create_colormap, on_dask_array, on_separate_bands, using_map_blocks
label_desc: Use image node_id 4 for calling a global function with example usage: _write_cmap_to_file(cmap_filename, cmap_data) without return types