[WIP] Detect Null gradient wrt non-sequences in scan

This is a first step towards trying to solve the problem described by Bitton Tenessi at https://groups.google.com/d/msg/theano-users/qgsifuG78KI/rm-oIN_fUbMJ

Still missing:
- [ ] tests
- [ ] are other checks (through shared, for instance) needed?