minor style fix for len usage and one "== None" occurrence

"corrected" a couple of len usages and one "== None" occurrence

Comparisons with None should be done with an identity test (is) not equality test (==).
Since __len__ can only return 0 or positive integers and Python evaluates any non-zero value as True in comparisons, if len(object) > 0 is equivalent to if len(object).