Avoid repeated startswith with rule.split(':', 1)

Strings are immutable, so after a split you have three variables instead
of one: the original variable, the bit before ':' and the bit
after ':'. Without the 1 (means: "stop after the first ':' found") you get a
list.
Use "x in (a, b, ..)" instead of "x == a or x == b ..".

Not necessary where you only have one "or", but consistency is also a
nice thing.

If the list is long, use a set() instead.
When prettyprinting lists, add a final ","

It doesn't hurt, and means you can safely reshuffle the order of the
lines if order is not relevant, or add another line anywhere in the
list/tuple/dict/set/whatevs.

Also makes for smaller context/unified diffs if you do change things
around.
It's okay to return early

Not really needed in this case but can flatten nested ifs/elifs and exit
before a potentially heavy test is performed