if irc.nick in irc.state.channels[channel].ops:
is incorrect, as it's not the necessary condition to have kick rights. Some networks may have half-ops and other things.
I just fixed this in Limnoria (a Supybot fork).
If you don't want to install Limnoria, you can apply this patch yourself to Supybot: https://github.com/ProgVal/Limnoria/commit/ac3724d32602146cc1026d412efbdadd8e44af9b