hide local variables from substitution for a user defined object



What is the best way to get this?

(%i1) my_subst(k, i, i*my_sum(i, [i]));
(%o1)                  k my_sum(i, [i]))

(%i1) my_subst(k, j,  my_sum(j*i, [i]));
(%o1)                    my_sum(k*i, [i]))

Here [i] is a list of variables local to `my_sum' and they should not
be substituted.