code: def main(args=None):
      """Main program function."""
      parser = _get_parser()
      opts = parser.parse_args(args)
      orig = nib.load(opts.infile)
  
      if not opts.force and Path(opts.outfile).exists():
          raise FileExistsError(f"Output file exists: {opts.outfile}")
  
      if opts.image_type:
          klass = getattr(nib, opts.image_type)
      else:
          klass = orig.__class__
  
      out_img = klass.from_image(orig)
      if opts.out_dtype:
          try:
              out_img.set_data_dtype(opts.out_dtype)
          except Exception as e:
              if opts.force:
                  warnings.warn(f"Ignoring error: {e!r}")
              else:
                  raise
  
      nib.save(out_img, opts.outfile)
  
imports: import argparse
  import warnings
  from pathlib import Path
  import nibabel
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types