code: def _write_data(
      data: np.ndarray,
      fileobj: io.IOBase,
      out_dtype: np.dtype,
      order: ty.Literal["C", "F"],
      in_cast: np.dtype | None = None,
      pre_clips: tuple[Scalar | None, Scalar | None] | None = None,
      inter: Scalar | np.ndarray = 0.0,
      slope: Scalar | np.ndarray = 1.0,
      post_clips: tuple[Scalar | None, Scalar | None] | None = None,
      nan_fill: Scalar | None = None,
  ) -> None:
      """Write array `data` to `fileobj` as `out_dtype` type, layout `order`
  
      Does not modify `data` in-place.
  
      Parameters
      ----------
      data : ndarray
      fileobj : object
          implementing ``obj.write``
      out_dtype : numpy type
          Type to which to cast output data just before writing
      order : {'F', 'C'}
          memory layout of array in fileobj after writing
      in_cast : None or numpy type, optional
          If not None, initial cast to do on `data` slices before further
          processing
      pre_clips : None or 2-sequence, optional
          If not None, minimum and maximum of input values at which to clip.
      inter : scalar or array, optional
          Intercept to subtract before writing ``out = data - inter``
      slope : scalar or array, optional
          Slope by which to divide before writing ``out2 = out / slope``
      post_clips : None or 2-sequence, optional
          If not None, minimum and maximum of scaled values at which to clip.
      nan_fill : None or scalar, optional
          If not None, values that were NaN in `data` will receive `nan_fill`
          in array as output to disk (after scaling).
      """
      data = np.squeeze(data)
      if data.ndim < 2:  # Trick to allow loop over rows for 1D arrays
          data = np.atleast_2d(data)
      elif order == "F":
          data = data.T
      nan_need_copy = (
          pre_clips,
          in_cast,
          inter,
          slope,
          post_clips,
      ) == (None, None, 0, 1, None)
      for dslice in data:  # cycle over first dimension to save memory
          if pre_clips is not None:
              dslice = np.clip(dslice, *pre_clips)
          if in_cast is not None:
              dslice = dslice.astype(in_cast)
          if inter != 0.0:
              dslice = dslice - inter
          if slope != 1.0:
              dslice = dslice / slope
          if post_clips is not None:
              dslice = np.clip(np.rint(dslice), *post_clips)
          if nan_fill is not None:
              nans = np.isnan(dslice)
              if np.any(nans):
                  if nan_need_copy:
                      dslice = dslice.copy()
                  dslice[nans] = nan_fill
          if dslice.dtype != out_dtype:
              dslice = dslice.astype(out_dtype)
          fileobj.write(dslice.tobytes())
  
imports: from __future__ import annotations
  import io
  import sys
  import typing
  import warnings
  from functools import reduce
  from operator import getitem, mul
  from os.path import exists, splitext
  import numpy
  from ._compression import COMPRESSED_FILE_LIKES
  from .casting import OK_FLOATS, shared_range
  from .externals.oset import OrderedSet
label_desc: Use image node_id 6 for calling a global function with example usage: _write_data(data, fileobj, out_dtype, order, in_cast, pre_clips, inter, slope, post_clips, nan_fill) without return types