why not use the fnmatch module instead of this check_pattern function so that we don't reinvent the wheel?