def METHOD_NAME(cls, message, category, filename, lineno):
    if isinstance(message, Warning):
        message = message.args[0]
    return cls({
        'message': message,
        'type': category.__name__,
        'filename': filename,
        'lineno': lineno,
        }, message=message, category=category)