It should be smarter about it. `Function('gamma')` is distinguishable from `class gamma(Function)` (the former is an instance of `UndefinedFunction`).