code: def _cast_values_for_fillna(values, dtype):
      """
      Cast values to a dtype that algos.pad and algos.backfill can handle.
      """
      # TODO: for int-dtypes we make a copy, but for everything else this
      #  alters the values in-place.  Is this intentional?
  
      if (
          is_datetime64_dtype(dtype)
          or is_datetime64tz_dtype(dtype)
          or is_timedelta64_dtype(dtype)
      ):
          values = values.view(np.int64)
  
      elif is_integer_dtype(values):
          # NB: this check needs to come after the datetime64 check above
          values = ensure_float64(values)
  
      return values
  
imports: from distutils.version import LooseVersion
  import operator
  import numpy
  from pandas._libs import algos, lib
  from pandas.compat import range, string_types
  from pandas.core.dtypes.cast import infer_dtype_from_array
  from pandas.core.dtypes.common import ensure_float64, is_datetime64_dtype, is_datetime64tz_dtype, is_float_dtype, is_integer, is_integer_dtype, is_numeric_v_string_like, is_scalar, is_timedelta64_dtype, needs_i8_conversion
  from pandas.core.dtypes.missing import isna
label_desc: Use image node_id 9 for calling a global function with example usage: _cast_values_for_fillna(values, dtype) and returns: values