def METHOD_NAME(self, action, *args):
    def register_formatter_class(formatter_cls):
        formatter = formatter_cls()
        self.formatters[action] = formatter
        self.choices.append((action, formatter.label))
    if args:
        # register_action has been invoked as register_action(action, label, message); create a LogFormatter
        # subclass and register that
        label, message = args
        formatter_cls = type(
            "_LogFormatter", (LogFormatter,), {"label": label, "message": message}
        )
        register_formatter_class(formatter_cls)
    else:
        # register_action has been invoked as a @register_action(action) decorator; return the function that
        # will register the class
        return register_formatter_class