def update_keychord_args(self, original_node, updated_node) -> cst.Call:
        """Changes 'mode' kwarg to 'mode' and 'value' kwargs."""
        args = original_node.args

        # (shouldn't be possible) if there are no args, stop here
        if not args:
            return original_node

        pos = 0

        # Look for the "mode" kwarg and get its position and value
        for i, arg in enumerate(args):
            if kwarg := arg.keyword:
                if kwarg.value == "mode":
                    # Ignore "mode" if it's already True or False
                    if m.matches(arg.value, (m.Name("True") | m.Name("False"))):
                        return original_node
                    pos = i
                    break
        # "mode" wasn't set so we can stop here
        else:
            return original_node

        self.lint(
            arg,  # We can pass the argument here which ensures the position is reported correctly
            "The use of mode='mode name' for KeyChord is deprecated. Use mode=True and value='mode name'.",
        )

        # Create two new kwargs
        # LibCST nodes are immutable so calling "with_changes" returns a new node
        name_arg = arg.with_changes(keyword=cst.Name("name"))
        mode_arg = arg.with_changes(value=cst.Name("True"))

        # Get the existing args and remove "mode"
        new_args = [a for i, a in enumerate(args) if i != pos]

        # Add "mode" and "value" kwargs
        new_args += [name_arg, mode_arg]

        # Return the updated node
        return updated_node.with_changes(args=new_args)
Changes 'mode' kwarg to 'mode' and 'value' kwargs.
libqtile/scripts/migrations/change_keychord_args.py