<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def findAllExceptions(pathToCheck):
 """ Find patterns of exceptions in a file or folder. @param patternFinder: a visitor for pattern checking and save results @return: patterns of special functions and classes """

    finder = PatternFinder()
    if os.path.isfile(pathToCheck):
        with open(pathToCheck) as f:
            findPatternsInFile(f.read(), finder)
    else:
        for path, dirs, files in os.walk(pathToCheck):
            for file in files:
                _, extname = os.path.splitext(file)
                if extname == ".py":
                    pathFile = os.path.join(path, file)
                    with open(pathFile) as f:
                        findPatternsInFile(f.read(), finder)
    return finder.patternsFunc, finder.patternsClass