code: def save_as_nifti_file(
      data: np.ndarray, affine: np.ndarray, path: Union[str, Path]
  ) -> None:
      """Create a Nifti file and save it.
  
      Parameters
      ----------
      data
          Brain data.
      affine
          Affine of the image, usually inherited from an existing image.
      path
          Output filename.
      """
      if not isinstance(path, str):
          path = str(path)
      img = Nifti1Pair(data, affine)
      nib.nifti1.save(img, path)
  
file_path: brainiak/brainiak/io.py
imports: from pathlib import Path
  from typing import Optional, Callable, Iterable, List, Union
  import logging
  import nibabel
  import numpy
  from nibabel.nifti1 import Nifti1Pair
  from nibabel.spatialimages import SpatialImage
  from .image import SingleConditionSpec
label_desc: Use image node_id 5 for calling a global function with example usage: save_as_nifti_file(data, affine, path) without return types