code: def check_rescaling(img1, img2, rescale_method):
      
  
      # estimating intensity ranges
      if rescale_method is None:
          # this section is to help user to avoid all intensity rescaling altogther!
          # TODO bug does not work yet, as pyplot does not offer any easy way to control it
          rescale_images = False
          min_value = None
          max_value = None
          norm_image = None  # mpl.colors.NoNorm doesn't work yet. data is getting linearly normalized to [0, 1]
      elif isinstance(rescale_method, str):
          if rescale_method.lower() in ['global']:
              # TODO need a way to alert the user if one of the distributions is too narrow
              #  in which case that image will be collapsed to an uniform value
              combined_distr = np.concatenate((img1.flatten(), img2.flatten()))
              min_value = combined_distr.min()
              max_value = combined_distr.max()
          elif rescale_method.lower() in ['each']:
              img1 = scale_0to1(img1)
              img2 = scale_0to1(img2)
              min_value = 0.0
              max_value = 1.0
          else:
              raise ValueError('rescaling method can only be "global" or "each"')
  
          rescale_images = True
          norm_image = mpl.colors.Normalize
      elif len(rescale_method) == 2:
          min_value = min(rescale_method)
          max_value = max(rescale_method)
          rescale_images = True
          norm_image = mpl.colors.Normalize
      else:
          raise ValueError('Invalid intensity range!. It must be either : '
                           '1) a list/tuple of two distinct values or'
                           '2) "global" indicating rescaling based on min/max values derived from both images or'
                           '3) None, no rescaling or norming altogether. ')
  
      return rescale_images, img1, img2, min_value, max_value
docs: Estimates the intensity range to clip the visualizations to