code: def stretch(img, arg0=None, arg1=None, dtype=np.uint8):
      """
      img' = stretch(img, [dtype=np.uint8])
      img' = stretch(img, max, [dtype=np.uint8])
      img' = stretch(img, min, max, [dtype=np.uint8])
  
      Contrast stretch the image to the range [0, max] (first form) or [min, max]
      (second form). The method is simple linear stretching according to the
      formula::
  
          p' = max * (p - img.min())/img.ptp() + min
  
      Parameters
      ----------
      img : ndarray
          input image. It is *not modified* by this function
      min : integer, optional
          minimum value for output [default: 0]
      max : integer, optional
          maximum value for output [default: 255]
      dtype : dtype of output,optional
           [default: np.uint8]
  
      Returns
      -------
      img': ndarray
          resulting image. ndarray of same shape as `img` and type `dtype`.
  
      Notes
      -----
      If max > 255, then it truncates the values if dtype is not specified.
      """
      if arg0 is None:
          min = 0
          max = 255
      elif arg1 is None:
          min = 0
          max = arg0
      else:
          min = arg0
          max = arg1
      img = img.astype(np.double, copy=True)
      img -= img.min()
      ptp = img.ptp()
      if not ptp:
          img = np.zeros(img.shape, dtype)
          if min:
              img += min
          return img
      img *= float(max - min) / ptp
      if min:
          img += min
      return img.astype(dtype, copy=False)
  
imports: from __future__ import division
  import numpy
  from .internal import _check_2
label_desc: Use image node_id 2 for calling a global function with example usage: stretch(img, arg0, arg1, dtype) and returns: img, img