I think it would be better to use an identity comparison here: `if decoder is not None: ...`.