docs: def findClosestMatchingGesture(strokes, gestureList, maxDifference=None):
      """
      Returns the gesture(s) in `gestureList` that closest matches the gesture in
      `strokes`. The `maxDifference` is how many differences there can be and still
      be considered a match.
      """
      if len(gestureList) == 0:
          return None
  
      #gestureList = [list(frozenset(tuple(gesture))) for gesture in gestureList] # make a unique list
      gestureList = frozenset([tuple(gesture) for gesture in gestureList])
      distances = {}
      for g in gestureList:
          levDist = levenshteinDistance(strokes, g)
          if maxDifference is None or levDist <= maxDifference:
              distances.setdefault(levDist, [])
              distances[levDist].append(g)
  
      if not distances:
          return None # No matching gestures are within the tolerance of maxDifference.
  
      return tuple(distances[min(distances.keys())])