<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def syntax_error(lineno, msg):
 """ Generic syntax error routine """

    if global_.has_errors > OPTIONS.max_syntax_errors.value:
        msg = 'Too many errors. Giving up!'

    msg = "%s:%i: %s" % (global_.FILENAME, lineno, msg)
    msg_output(msg)

    if global_.has_errors > OPTIONS.max_syntax_errors.value:
        sys.exit(1)

    global_.has_errors += 1