code: def _rbo_ext(x, y, p, k, uneven_lengths=True):
      if len(x) <= len(y):
          S = x
          L = y
      else:
          S = y
          L = x
      l = min(k, len(L))
      s = min(k, len(S))
      if uneven_lengths:
          Xd = [
              len(np.intersect1d(S[: (i + 1)], L[: (i + 1)]))
              for i in range(l)
          ]
          if l > s:
              sl_range = np.arange(s + 1, l + 1)
          else:
              sl_range = np.arange(l, s + 2)
          result = ((1 - p) / p) * (
              (
                  sum(
                      Xd[:l]
                      / np.arange(1, l + 1)
                      * p ** np.arange(1, l + 1)
                  )
              )
              + (
                  sum(
                      Xd[s - 1]
                      * (sl_range - s)
                      / (s * sl_range)
                      * p**sl_range
                  )
              )
          ) + ((Xd[l - 1] - Xd[s - 1]) / l + (Xd[s - 1] / s)) * p**l
      else:
          k = min(s, k)
          Xd = [
              len(np.intersect1d(x[: (i + 1)], y[: (i + 1)]))
              for i in range(k)
          ]
          Xk = Xd[k - 1]
          result = (Xk / k) * p**k + (
              ((1 - p) / p)
              * sum(
                  (Xd / np.arange(1, k + 1)) * p ** np.arange(1, k + 1)
              )
          )
      return result
  
imports: import numpy
  from scipy.stats import rankdata
label_desc: Use image node_id 5 for calling a global function with example usage: _rbo_ext(x, y, p, k, uneven_lengths) and returns: result