<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def log_message(self, format, *args):
 """ overrides the ``log_message`` method from the wsgiref server so that normal logging works with whatever configuration the application has been set to. Levels are inferred from the HTTP status code, 4XX codes are treated as warnings, 5XX as errors and everything else as INFO level. """

        code = args[1][0]
        levels = {
            '4': 'warning',
            '5': 'error'
        }

        log_handler = getattr(logger, levels.get(code, 'info'))
        log_handler(format % args)