code: def linear_rescale(image, in_range=(0, 1), out_range=(1, 255)):
      
      imin, imax = in_range
      omin, omax = out_range
      image = np.clip(image, imin, imax) - imin
      image = image / np.float(imax - imin)
      return image * (omax - omin) + omin
docs: Linear rescaling.
  
      Attributes
      ----------
      image : numpy ndarray
          Image array to rescale.
      in_range : list, int, optional, (default: [0,1])
          Image min/max value to rescale.
      out_range : list, int, optional, (default: [1,255])
          output min/max bounds to rescale to.
  
      Returns
      -------
      out : numpy ndarray
          returns rescaled image array.