<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def checkpat(self, pattern):
 """ check for errors in a regex pattern """

        if pattern is None:
            return
        try:
            re.match(pattern, "")
        except re.error:
            print3("\nBad user-defined singular pattern:\n\t%s\n" % pattern)
            raise BadUserDefinedPatternError