code: def save(filename, obj):
      """Save an nipy image object to a file."""
      obj = as_volume_img(obj, copy=False)
      hdr = nib.Nifti1Header()
      for key, value in obj.metadata.items():
          if key in hdr:
              hdr[key] = value
      img = nib.Nifti1Image(obj.get_fdata(), obj.affine, header=hdr)
      nib.save(img, filename)
  
file_path: nipy/nipy/labs/datasets/converters.py
imports: import os
  import nibabel
  import numpy
  from nibabel.spatialimages import SpatialImage
  from nipy.io.nibcompat import get_affine, get_header
  from .volumes.volume_img import VolumeImg
label_desc: Use image node_id 2 for calling a global function with example usage: save(filename, obj) without return types