def replace(self, new_value, args, kwargs):
        if self.arg_pos is not None and len(args) > self.arg_pos:
            # The arg to replace is passed positionally
            old_value = args[self.arg_pos]
            args = list(args)  # *args is normally a tuple
            args[self.arg_pos] = new_value
        else:
            # The arg to replace is either omitted or passed by keyword.
            old_value = kwargs.get(self.name)
            kwargs[self.name] = new_value
        return old_value, args, kwargs
INTEGRATION: try to write  value to an existing directory
dataset/ETHPy150Open D-L/SimpleBookMarks/src/tornado/util.py/ArgReplacer.replace--crossover with--dataset/ETHPy150Open jplana/python-etcd/src/etcd/tests/integration/test_simple.py/TestErrors.test_is_not_a_file