code: def convert(image, dtype, force_copy=False, uniform=False):
      """
      Convert an image to the requested data-type.
      Warnings are issued in case of precision loss, or when negative values
      are clipped during conversion to unsigned integer types (sign loss).
      Floating point values are expected to be normalized and will be clipped
      to the range [0.0, 1.0] or [-1.0, 1.0] when converting to unsigned or
      signed integers respectively.
      Numbers are not shifted to the negative side when converting from
      unsigned to signed integer types. Negative values will be clipped when
      converting to unsigned integers.
      Parameters
      ----------
      image : ndarray
          Input image.
      dtype : dtype
          Target data-type.
      force_copy : bool, optional
          Force a copy of the data, irrespective of its current dtype.
      uniform : bool, optional
          Uniformly quantize the floating point range to the integer range.
          By default (uniform=False) floating point values are scaled and
          rounded to the nearest integers, which minimizes back and forth
          conversion errors.
      .. versionchanged :: 0.15
          ``convert`` no longer warns about possible precision or sign
          information loss. See discussions on these warnings at:
          https://github.com/scikit-image/scikit-image/issues/2602
          https://github.com/scikit-image/scikit-image/issues/543#issuecomment-208202228
          https://github.com/scikit-image/scikit-image/pull/3575
      References
      ----------
      .. [1] DirectX data conversion rules.
             https://msdn.microsoft.com/en-us/library/windows/desktop/dd607323%28v=vs.85%29.aspx
      .. [2] Data Conversions. In "OpenGL ES 2.0 Specification v2.0.25",
             pp 7-8. Khronos Group, 2010.
      .. [3] Proper treatment of pixels as integers. A.W. Paeth.
             In "Graphics Gems I", pp 249-256. Morgan Kaufmann, 1990.
      .. [4] Dirty Pixels. J. Blinn. In "Jim Blinn's corner: Dirty Pixels",
             pp 47-57. Morgan Kaufmann, 1998.
      """
      image = np.asarray(image)
      dtypeobj_in = image.dtype
      if dtype is np.floating:
          dtypeobj_out = np.dtype("float64")
      else:
          dtypeobj_out = np.dtype(dtype)
      dtype_in = dtypeobj_in.type
      dtype_out = dtypeobj_out.type
      kind_in = dtypeobj_in.kind
      kind_out = dtypeobj_out.kind
      itemsize_in = dtypeobj_in.itemsize
      itemsize_out = dtypeobj_out.itemsize
  
      # Below, we do an `issubdtype` check.  Its purpose is to find out
      # whether we can get away without doing any image conversion.  This happens
      # when:
      #
      # - the output and input dtypes are the same or
      # - when the output is specified as a type, and the input dtype
      #   is a subclass of that type (e.g. `np.floating` will allow
      #   `float32` and `float64` arrays through)
  
      if np.issubdtype(dtype_in, np.obj2sctype(dtype)):
          if force_copy:
              image = image.copy()
          return image
  
      if not (
          dtype_in in _supported_types and dtype_out in _supported_types
      ):
          raise ValueError(
              "Can not convert from {} to {}.".format(
                  dtypeobj_in, dtypeobj_out
              )
          )
  
      if kind_in in "ui":
          imin_in = np.iinfo(dtype_in).min
          imax_in = np.iinfo(dtype_in).max
      if kind_out in "ui":
          imin_out = np.iinfo(dtype_out).min
          imax_out = np.iinfo(dtype_out).max
  
      # any -> binary
      if kind_out == "b":
          return image > dtype_in(dtype_range[dtype_in][1] / 2)
  
      # binary -> any
      if kind_in == "b":
          result = image.astype(dtype_out)
          if kind_out != "f":
              result *= dtype_out(dtype_range[dtype_out][1])
          return result
  
      # float -> any
      if kind_in == "f":
          if kind_out == "f":
              # float -> float
              return image.astype(dtype_out)
  
          if np.min(image) < -1.0 or np.max(image) > 1.0:
              raise ValueError(
                  "Images of type float must be between -1 and 1."
              )
          # floating point -> integer
          # use float type that can represent output integer type
          computation_type = _dtype_itemsize(
              itemsize_out, dtype_in, np.float32, np.float64
          )
  
          if not uniform:
              if kind_out == "u":
                  image_out = np.multiply(
                      image, imax_out, dtype=computation_type
                  )
              else:
                  image_out = np.multiply(
                      image,
                      (imax_out - imin_out) / 2,
                      dtype=computation_type,
                  )
                  image_out -= 1.0 / 2.0
              np.rint(image_out, out=image_out)
              np.clip(image_out, imin_out, imax_out, out=image_out)
          elif kind_out == "u":
              image_out = np.multiply(
                  image, imax_out + 1, dtype=computation_type
              )
              np.clip(image_out, 0, imax_out, out=image_out)
          else:
              image_out = np.multiply(
                  image,
                  (imax_out - imin_out + 1.0) / 2.0,
                  dtype=computation_type,
              )
              np.floor(image_out, out=image_out)
              np.clip(image_out, imin_out, imax_out, out=image_out)
          return image_out.astype(dtype_out)
  
      # signed/unsigned int -> float
      if kind_out == "f":
          # use float type that can exactly represent input integers
          computation_type = _dtype_itemsize(
              itemsize_in, dtype_out, np.float32, np.float64
          )
  
          if kind_in == "u":
              # using np.divide or np.multiply doesn't copy the data
              # until the computation time
              image = np.multiply(
                  image, 1.0 / imax_in, dtype=computation_type
              )
              # DirectX uses this conversion also for signed ints
              # if imin_in:
              #     np.maximum(image, -1.0, out=image)
          else:
              image = np.add(image, 0.5, dtype=computation_type)
              image *= 2 / (imax_in - imin_in)
  
          return np.asarray(image, dtype_out)
  
      # unsigned int -> signed/unsigned int
      if kind_in == "u":
          if kind_out == "i":
              # unsigned int -> signed int
              image = _scale(
                  image, 8 * itemsize_in, 8 * itemsize_out - 1
              )
              return image.view(dtype_out)
          else:
              # unsigned int -> unsigned int
              return _scale(image, 8 * itemsize_in, 8 * itemsize_out)
  
      # signed int -> unsigned int
      if kind_out == "u":
          image = _scale(image, 8 * itemsize_in - 1, 8 * itemsize_out)
          result = np.empty(image.shape, dtype_out)
          np.maximum(
              image, 0, out=result, dtype=image.dtype, casting="unsafe"
          )
          return result
  
      # signed int -> signed int
      if itemsize_in > itemsize_out:
          return _scale(
              image, 8 * itemsize_in - 1, 8 * itemsize_out - 1
          )
  
      image = image.astype(_dtype_bits("i", itemsize_out * 8))
      image -= imin_in
      image = _scale(
          image, 8 * itemsize_in, 8 * itemsize_out, copy=False
      )
      image += imin_out
      return image.astype(dtype_out)
  
imports: import numpy
  from scipy import linalg
  from warnings import warn
label_desc: Use image node_id 16 for calling a global function with example usage: convert(image, dtype, force_copy, uniform) and returns: image, image, unknown, result, image_out, np, result, _scale, image, image, _scale