Just check that it doesn't depend on `x`, `y`, or `f(x, y)`. Just check if `x` and `y` are in the free_symbols. Actually, if you put `x` and `y` in the exclude of the Wild, it should automatically match coefficients iff they don't depend on `x` and `y`.