By convention, in Python we use underscores for "throwaway" variables, for example when unpacking a tuple only a few of whose members we're interested in.
The bug was on line 48, which had `if not is_subnet`, checking the truthiness of the `is_subnet` function rather than calling it with `network`.
The other changes shorten up function bodies by, variously, removing an intermediate variable, returning early in a function returning a boolean, and simplifying `is_subnet` to a single line.