code: def grab_contours(cnts):
      # if the length the contours tuple returned by cv2.findContours
      # is '2' then we are using either OpenCV v2.4, v4-beta, or
      # v4-official
      if len(cnts) == 2:
          cnts = cnts[0]
  
      # if the length of the contours tuple is '3' then we are using
      # either OpenCV v3, v4-pre, or v4-alpha
      elif len(cnts) == 3:
          cnts = cnts[1]
  
      # otherwise OpenCV has changed their cv2.findContours return
      # signature yet again and I have no idea WTH is going on
      else:
          raise Exception(
              (
                  "Contours tuple must have length 2 or 3, "
                  "otherwise OpenCV changed their cv2.findContours return "
                  "signature yet again. Refer to OpenCV's documentation "
                  "in that case"
              )
          )
  
      # return the actual contours array
      return cnts
  
file_path: imutils/imutils/convenience.py
imports: import numpy
  import cv2
  import sys
label_desc: Use image node_id 9 for calling a global function with example usage: grab_contours(cnts) and returns: cnts