Substituted comparisons '<>None' with 'is not None'