Isn't that exactly what I'm doing? Note that the check in line 389 is identical to this:
```
if hasattr(tensor, "_form") and hasattr(tensor, "_kernels") and tensor._form is f
```