code: def find_final_crop(im, rects):
      current = None
      for rect in rects:
          if current is None:
              current = rect
              continue
  
          aligned = rects_are_vertical(current, rect)
  
          if not aligned:
              continue
  
          current = rect_union(current, rect)
      return current
  
imports: import os
  import traceback
  import sys
  import cv2
  import numpy
  from PIL import Image
  from scipy.ndimage.filters import rank_filter
  import pytesseract
label_desc: Use image node_id 13 for calling a global function with example usage: find_final_crop(im, rects) and returns: current