def _ensure_unique_var_names(v_set):
        """
        v_set: set[Variable]

        All variables in v_set should have different names. Raise ValueError
        otherwise
        """
        names = [v.name for v in v_set]
        dup_names = [name for name, count in collections.Counter(names).items() if count > 1]
        if len(dup_names) > 0:
            raise ValueError(f"Var names {dup_names} is used both as function's input and output")

        v_set: set[Variable]

        All variables in v_set should have different names. Raise ValueError
        otherwise
        
coremltools/converters/mil/mil/passes/defs/cleanup/dedup_op_and_var_names.py