docs: def imwrite(file, data=None, shape=None, dtype=None, **kwargs):
      """Write numpy array to TIFF file.
  
      Refer to the TiffWriter class and its asarray function for documentation.
  
      A BigTIFF file is created if the data size in bytes is larger than 4 GB
      minus 32 MB (for metadata), and 'bigtiff' is not specified, and 'imagej'
      or 'truncate' are not enabled.
  
      Parameters
      ----------
      file : str or binary stream
          File name or writable binary stream, such as an open file or BytesIO.
      data : array_like
          Input image. The last dimensions are assumed to be image depth,
          height, width, and samples.
          If None, an empty array of the specified shape and dtype is
          saved to file.
          Unless 'byteorder' is specified in 'kwargs', the TIFF file byte order
          is determined from the data's dtype or the dtype argument.
      shape : tuple
          If 'data' is None, shape of an empty array to save to the file.
      dtype : numpy.dtype
          If 'data' is None, data-type of an empty array to save to the file.
      kwargs : dict
          Parameters 'append', 'byteorder', 'bigtiff', and 'imagej', are passed
          to the TiffWriter constructor. Other parameters are passed to the
          TiffWriter.save function.
  
      Returns
      -------
      offset, bytecount : tuple or None
          If the image data are written contiguously, return offset and bytecount
          of image data in the file.
  
      """
      tifargs = parse_kwargs(kwargs, 'append', 'bigtiff', 'byteorder', 'imagej')
      if data is None:
          dtype = numpy.dtype(dtype)
          size = product(shape) * dtype.itemsize
          byteorder = dtype.byteorder
      else:
          try:
              size = data.nbytes
              byteorder = data.dtype.byteorder
          except Exception:
              size = 0
              byteorder = None
      bigsize = kwargs.pop('bigsize', 2**32-2**25)
      if 'bigtiff' not in tifargs and size > bigsize and not (
              tifargs.get('imagej', False) or tifargs.get('truncate', False)):
          tifargs['bigtiff'] = True
      if 'byteorder' not in tifargs:
          tifargs['byteorder'] = byteorder
  
      with TiffWriter(file, **tifargs) as tif:
          return tif.save(data, shape, dtype, **kwargs)