code: def findBestMatch(self, needle, similarity):
          
          method = cv2.TM_CCOEFF_NORMED
          position = None
  
          match = cv2.matchTemplate(self.haystack, needle, method)
          min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(match)
          if method == cv2.TM_SQDIFF_NORMED or method == cv2.TM_SQDIFF:
              confidence = min_val
              if min_val <= 1-similarity:
                  # Confidence checks out
                  position = min_loc
          else:
              confidence = max_val
              if max_val >= similarity:
                  # Confidence checks out
                  position = max_loc
  
          if not position:
              return None
  
          return (position, confidence)
docs: Find the best match for ``needle`` that has a similarity better than or equal to ``similarity``.
  
          Returns a tuple of ``(position, confidence)`` if a match is found, or ``None`` otherwise.
  
          *Developer's Note - Despite the name, this method actually returns the **first** result
          with enough similarity, not the **best** result.*