code: def imwrite(
      uri,
      image,
      *,
      plugin=None,
      extension=None,
      format_hint=None,
      **kwargs,
  ):
      """Write an ndimage to the given URI.
  
      The exact behavior depends on the file type and plugin used. To learn about
      the exact behavior, check the documentation of the relevant plugin.
  
      Parameters
      ----------
      uri : {str, pathlib.Path, bytes, file}
          The resource to save the image to, e.g. a filename, pathlib.Path,
          http address or file object, check the docs for more info.
      image : np.ndarray
          The image to write to disk.
      plugin : {str, None}
          The plugin to use. If set to None (default) imwrite will perform a
          search for a matching plugin. If not None, this takes priority over
          the provided format hint (if present).
      extension : str
          If not None, treat the provided ImageResource as if it had the given
          extension. This affects the order in which backends are considered, and
          may also influence the format used when encoding.
      format_hint : str
          Deprecated. Use `extension` instead.
      **kwargs :
          Additional keyword arguments will be passed to the plugin's ``write``
          call.
  
      Returns
      -------
      encoded_image : None or Bytes
          Returns ``None`` in all cases, except when ``uri`` is set to ``<bytes>``.
          In this case it returns the encoded ndimage as a bytes string.
  
      """
  
      with imopen(
          uri,
          "w",
          legacy_mode=False,
          plugin=plugin,
          format_hint=format_hint,
          extension=extension,
      ) as img_file:
          encoded = img_file.write(image, **kwargs)
  
      return encoded
  
imports: import numpy
  from .core.imopen import imopen
label_desc: Use image node_id 3 for calling a global function with example usage: imwrite(uri, image) and returns: encoded