code: def _get_target_dtype(dtype, target_dtype):
      """Return a new dtype if conversion is needed.
  
      Parameters
      ----------
      dtype: dtype
          Data type of the original data
  
      target_dtype: {None, dtype, "auto"}
          If None, no conversion is required. If a type is provided, the
          function will check if a conversion is needed. The "auto" mode will
          automatically convert to int32 if dtype is discrete and float32 if it
          is continuous.
  
      Returns
      -------
      dtype: dtype
          The data type toward which the original data should be converted.
      """
      if target_dtype is None:
          return None
      if target_dtype == "auto":
          if dtype.kind == "i":
              target_dtype = np.int32
          else:
              target_dtype = np.float32
      if target_dtype == dtype:
          return None
      return target_dtype
  
file_path: nilearn/nilearn/_utils/niimg.py
imports: import collections.abc
  import copy
  import gc
  from pathlib import Path
  from warnings import warn
  import nibabel
  import numpy
  from .helpers import stringify_path
label_desc: Use image node_id 3 for calling a global function with example usage: _get_target_dtype(dtype, target_dtype) and returns: target_dtype, None, None