Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.