code: def compare_rep_frames(
      answerF, repFrame, tolerance, colIndex, grabTopN=-1
  ):
      # actual answer is in second column of repFrame
      highIndex = int(round(repFrame.nrow / 4))
      allIndex = range(answerF.nrow - highIndex, answerF.nrow)
      if grabTopN < 0:  # get bottom N percent
          allIndex = range(0, highIndex)
      repIndex = 0
      answerArray = np.transpose(
          answerF[colIndex].as_data_frame(header=False).values
      )[0]
      topBottomArray = np.transpose(
          repFrame[1].as_data_frame(header=False).values
      )[0]
  
      answerArray = np.sort(answerArray)
      topBottomArray = np.sort(topBottomArray)
  
      for ind in allIndex:
          assert (
              abs(answerArray[ind] - topBottomArray[repIndex * 4])
              < tolerance
          ), "Expected {0}, Actual {1} .".format(
              answerArray[ind], topBottomArray[repIndex * 4]
          )
          repIndex = repIndex + 1
  
imports: import sys
  import h2o
  from tests import pyunit_utils
  from random import randint
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: compare_rep_frames(answerF, repFrame, tolerance, colIndex, grabTopN) without return types