code: def save_data(
      input_data,
      output_filename,
      reference_data=None,
      metadata=None,
      affine=None,
      output_format=None,
      **kwargs,
  ):
      if output_format is None:
          output_format = check_format(output_filename)
  
      if isinstance(input_data, str) and output_format != "text":
          (
              input_data,
              metadata,
              reference_data,
              data_format,
          ) = convert_input_2_numpy(input_data, return_all=True)
  
      return SAVE_EXPORTER_LIST[output_format](
          input_data,
          output_filename,
          reference_data=reference_data,
          metadata=metadata,
          affine=affine,
      )
  
imports: import os
  import numpy
  import nibabel
  import nrrd
  import pydicom
  import subprocess
  from collections import defaultdict
  from imageio import imwrite, imread
  from deepneuro.utilities.util import grab_files_recursive, quotes
label_desc: Use image node_id 19 for calling a global function with example usage: save_data(input_data, output_filename, reference_data, metadata, affine, output_format) and returns: SAVE_EXPORTER_LIST