It is better to add `import types` to the top, and use `if isinstance(value, (self.number_type, types.NoneType)):` instead of `if isinstance(value, self.number_type) or value is None:`.