Firstly, `isinstance()` is generally better than `type(foo) is sometype` for various reasons. If you really need the latter instead for some reason (and you don't in this case), it should be commented.

Secondly, having two different kinds of return value is confusing. Either both parts should always be present (and then the `result = yield ...` becomes `next_state, session_update = yield ...`) or the handler should just take care of its own session data changes. I prefer the latter.