Is there any reason this couldn't be `if not (field,value) in self.indexes:`? This form seems ridiculously complex.