<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def warning(self_, msg,*args,**kw):
 """ Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments. See Python's logging module for details of message formatting. """

        if not warnings_as_exceptions:
            global warning_count
            warning_count+=1
            self_.__db_print(WARNING,msg,*args,**kw)
        else:
            raise Exception("Warning: " + msg % args)