code: def upper_bound_by_rate(data, rate=0.05):
      r"""Adjusts upper intensity boundary using rates
  
      It calculates the image intensity histogram, and based on the rate value it
      decide what is the upperbound value for intensity normalization, usually
      lower bound is 0. The rate is the ratio between the amount of pixels in
      every bins and the bins with highest pixel amount
  
      Parameters
      ----------
      data : float
          Input intensity value data
      rate : float
          representing the threshold whether a specific histogram bin that should
          be count in the normalization range
  
      Returns
      -------
      high : float
  
          the upper_bound value for normalization
      """
  
      g, h = np.histogram(data)
      m = np.zeros((10, 3))
      high = data.max()
      for i in np.array(range(10)):
          m[i, 0] = g[i]
          m[i, 1] = h[i]
          m[i, 2] = h[i + 1]
  
      g = sorted(g, reverse=True)
      sz = np.size(g)
  
      Index = 0
  
      for i in np.array(range(sz)):
          if g[i] / g[0] > rate:
              Index = Index + 1
  
      for i in np.array(range(10)):
          for j in np.array(range(Index)):
              if g[j] == m[i, 0]:
                  high = m[i, 2]
      return high
  
label_desc: Use image node_id 2 for calling a global function with example usage: upper_bound_by_rate(data, rate) and returns: high